我有两个共享库:A.so
和B.so
,并希望将它们与我的Android Project
相关联。
JNI
,JNI/projectname.cpp
和JNI/Android.mk
A.so
和B.so
添加到<Project-folder>/libs/armeabi
当我构建项目时,我在控制台中获得了这个输出:
**** Build of configuration Default for project fona ****
/home/users/android-ndk/ndk-build all
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
[armeabi] Install : projectname.so => libs/armeabi/libprojectname.so
*** Build Finished ****
我担心的是它没有A.so
和B.so
Project.so
。可能是Android.mk
文件中缺少的东西
Android.mk
文件的内容:LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := projectname
LOCAL_SRC_FILES := projectname.cpp
include $(BUILD_SHARED_LIBRARY)
答案 0 :(得分:4)
您不能只放置预建库。您还需要将其定义为单独的模块。 将A.so和B.so移动到jni文件夹,然后像这样修改Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := A
LOCAL_SRC_FILES := A.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := B
LOCAL_SRC_FILES := B.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := projectname
LOCAL_SRC_FILES := projectname.cpp
include $(BUILD_SHARED_LIBRARY)