android ndk开发 如何实现一个so包含另一个so
2个回答
展开全部
不推荐在jni库之外用so,因为这种情况下,需要在java代码里面依次加载相关的so。
如果一定要用的话android.mk里面的内容如下:
LOCAL_PATH:= $(call my-dir)
# first so, which will be built shared
include $(CLEAR_VARS)
LOCAL_MODULE := shared1
LOCAL_SRC_FILES := libnshared1.so
include $(PREBUILT_SHARED_LIBRARY)
# second so, which will be built shared
include $(CLEAR_VARS)
LOCAL_MODULE := shared2
LOCAL_SRC_FILES := libnshared2.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := yourjni
LOCAL_SRC_FILES := xxxx.cpp
LOCAL_SHARED_LIBRARIES := shared1
LOCAL_SHARED_LIBRARIES := shared2
LOCAL_LDLIBS := -llog
#LOCAL_LDFLAGS = $(LOCAL_PATH)/obj/libstdc++.a
#LOCAL_CPPFLAGS += -lstdc++
include $(BUILD_SHARED_LIBRARY)
如果一定要用的话android.mk里面的内容如下:
LOCAL_PATH:= $(call my-dir)
# first so, which will be built shared
include $(CLEAR_VARS)
LOCAL_MODULE := shared1
LOCAL_SRC_FILES := libnshared1.so
include $(PREBUILT_SHARED_LIBRARY)
# second so, which will be built shared
include $(CLEAR_VARS)
LOCAL_MODULE := shared2
LOCAL_SRC_FILES := libnshared2.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := yourjni
LOCAL_SRC_FILES := xxxx.cpp
LOCAL_SHARED_LIBRARIES := shared1
LOCAL_SHARED_LIBRARIES := shared2
LOCAL_LDLIBS := -llog
#LOCAL_LDFLAGS = $(LOCAL_PATH)/obj/libstdc++.a
#LOCAL_CPPFLAGS += -lstdc++
include $(BUILD_SHARED_LIBRARY)
更多追问追答
追问
我是要打包 不是共享。 不是LOCAL_SHARED_LIBRARIES
追答
你说的是打apk包,还是把so加入到so中?
如果是打apk包,需要把so拷贝到.\libs\armeabi目录下再打apk包,之前我试过用手动拷贝.so到该目录下,你可以试着做个脚本,然后在android.mk中调用完成同样功能。
如果你是说把so加入到so中,显然你需要考虑把你的so转换为.a,这样很方便。
展开全部
我刚刚发布的一篇经验关于"android ndk 动态库":
http://jingyan.baidu.com/article/c910274bffa502cd361d2da0.html
http://jingyan.baidu.com/article/c910274bffa502cd361d2da0.html
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询