问题描述
我实现了一个JNI的Android应用程序。此应用程序需要一些额外的共享库被包装为APK的一部分。使用Ecplise,我已经添加了这些库到项目的'/库/ armeabi文件夹中。
I have implemented a JNI android application. This application requires a few additional 'Shared Libs' to be packed as part of the APK. Using Ecplise, I have added these libs to the project's '/libs/armeabi' folder.
然而,启动应用程序(通过集成的调试器)的时候,我增加了共享库'是从'armeabi文件夹中删除。
However, when launching the application (through the integrated debugger), my added 'Shared Libs' are removed from the 'armeabi' folder.
- 如何prevent从这些额外的库被删除?
- 如何确保其他所需的战略目标是装在APK?
推荐答案
您不必复制此库库
文件夹自己。这项工作应该由要做的 NDK的构建
。
You don't need to copy this libraries to libs
folder yourself. This job should be done by the ndk-build
.
这两个步骤应该是足够了:
These two steps should be enough:
-
创建
mylibs
(你可以使用任何其他名称代替)上的文件夹项目的根目录下。并把你的库到这个文件夹。
Create
mylibs
(you can use any other name instead) folder on the root level of your project. And put your libraries into this folder.
对于每个库前添加以下行包括$(CLEAR_VARS)
语句替换 MYLIB
与您库名称:
For each library add the following lines before the include $(CLEAR_VARS)
statement replacing mylib
with you library name:
include $(CLEAR_VARS)
LOCAL_MODULE:=mylib
LOCAL_SRC_FILES:=../mylibs/libmylib.so
include $(PREBUILT_SHARED_LIBRARY)
(您可能需要为 LOCAL_SRC_FILES
略有不同的道路。这取决于你的Eclipse配置。)
(You might need slightly different path for LOCAL_SRC_FILES
. It depends on your Eclipse configuration.)
这篇关于Android的JNI APK包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!