请各位帮我看下我的 问题出在哪了
这是Applcition.mk的内容
APP_PROJECT_PATH := $(call my-dir)
APP_MODULES := libtutorial-zeroone libtutorial-zerotwo
这是Android.mk的内容
LOCAL_PATH:= $(call my-dir)# first lib, which will be built statically
#
include $(CLEAR_VARS)LOCAL_MODULE := first
LOCAL_SRC_FILES := first.cinclude $(BUILD_SHARED_LIBRARY)# second lib, which will depend on and include the first one
#
include $(CLEAR_VARS)LOCAL_MODULE := second
LOCAL_SRC_FILES := second.c
LOCAL_SHARED_LIBRARIES := firstinclude $(BUILD_SHARED_LIBRARY)两个C文件的内容
first内容
#include "first.h"int first(int x, int y)
{
return x + y;
}
second.c内容
#include "first.h"
#include <jni.h>jint
Java_com_example_twolibs_TwoLibs_add( JNIEnv* env,
jobject this,
jint x,
jint y ){
// void* filehandle = dlopen("/data/data/com.example.twolibs/libtwolib-first.so", RTLD_LAZY );
return first(x, y);
}
可以编译成功
但运行时会报错:
java.lang.UnsatisfiedLinkError: Library second not found
这是Applcition.mk的内容
APP_PROJECT_PATH := $(call my-dir)
APP_MODULES := libtutorial-zeroone libtutorial-zerotwo
这是Android.mk的内容
LOCAL_PATH:= $(call my-dir)# first lib, which will be built statically
#
include $(CLEAR_VARS)LOCAL_MODULE := first
LOCAL_SRC_FILES := first.cinclude $(BUILD_SHARED_LIBRARY)# second lib, which will depend on and include the first one
#
include $(CLEAR_VARS)LOCAL_MODULE := second
LOCAL_SRC_FILES := second.c
LOCAL_SHARED_LIBRARIES := firstinclude $(BUILD_SHARED_LIBRARY)两个C文件的内容
first内容
#include "first.h"int first(int x, int y)
{
return x + y;
}
second.c内容
#include "first.h"
#include <jni.h>jint
Java_com_example_twolibs_TwoLibs_add( JNIEnv* env,
jobject this,
jint x,
jint y ){
// void* filehandle = dlopen("/data/data/com.example.twolibs/libtwolib-first.so", RTLD_LAZY );
return first(x, y);
}
可以编译成功
但运行时会报错:
java.lang.UnsatisfiedLinkError: Library second not found
LOCAL_SHARED_LIBRARIES := first 应该写成LOCAL_SHARED_LIBRARIES := /first
但是每次这样push好累啊 谁还有什么号得解决方法啊