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.
However, when launching the application (through the integrated debugger), my added 'Shared Libs' are removed from the 'armeabi' folder.
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:
Create mylibs
(you can use any other name instead) folder on the root level of your project. And put your libraries into this folder.
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)
(You might need slightly different path for LOCAL_SRC_FILES
. It depends on your Eclipse configuration.)
One more note to add in this context is that the path to the external SharedLib MUST BE relative to the jni directory ( or to whatever spcified @ LOCAL_PATH ), that is, "LOCAL_SRC_FILES := ../../../Android/ffmpeg/libavcodec/libavcodec.so" will work where the absolute path will not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With