Android.mk如下,想用四个外部的.a生成一个.so文件,.a和test.c均位于$PROJECT/jni根目录,test.c只包含一个空函数,
这个makefile生成的libtest.so只有不到2K,而四个静态库加起来有1.5M,明显没有包含进去,请问有哪位弄过类似编译的,能否指点一下在下,万分感谢!
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := LibA
LOCAL_SRC_FILES := lib3rd1.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := LibB
LOCAL_SRC_FILES := lib3rd2.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := LibC
LOCAL_SRC_FILES := lib3rd3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := LibD
LOCAL_SRC_FILES := lib3rd4.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_SRC_FILES := test.c
LOCAL_STATIC_LIBRARIES := LibA LibB LibC LibD
include $(BUILD_SHARED_LIBRARY)
以下是编译log:
[email protected]:~/share_vm/hello2$ ndk-build
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Compile thumb : test <= hello-jni.c
Prebuilt : libgroupsock.a <= jni/
Prebuilt : libliveMedia.a <= jni/
Prebuilt : libBasicUsageEnvironment.a <= jni/
Prebuilt : libUsageEnvironment.a <= jni/
SharedLibrary : libtest.so
Install : libtest.so => libs/armeabi/libtest.so
[email protected]:~/share_vm/hello2$ ls ./libs/armeabi/libtest.so -al
-rwxrwxrwx 1 root root 1584 2012-01-09 00:22 ./libs/armeabi/libtest.so
[email protected]:~/share_vm/hello2$ du -b ./jni/*.a
53142 ./jni/libBasicUsageEnvironment.a
67580 ./jni/libgroupsock.a
1333298 ./jni/libliveMedia.a
9684 ./jni/libUsageEnvironment.a
------解决方案--------------------
http://www.cnblogs.com/qq78292959/archive/2011/11/02/2232946.html
你可以参考这个里面的说明
------解决方案--------------------
我的是可以的,和你的区别是我在JNI下新建了prebuilt目录,然后写一个Android.mk,将需要添加的静态库添加进去