1

Here is my project layout.

Project MyLib - Android library project. It contains jni directory that creates libMyA.so.

Project MyMain - Android application project. In Eclipse, I have added MyLib as a dependent project from Properties-->Android-->Reference UI.

When Eclipse builds the .apk file, the problem is that it does not include libMyA.so.

As a workaround, I can manually copy MyLib\libs\armeabi\libMyA.so to MyMain\libs\armeabi\libMyA.so. Now, when the .apk file is built, it does contain the library file.

I am wondering if I missed some other setting that I should have specified.

Peter
  • 11,260
  • 14
  • 78
  • 155
  • libs.so files are present with jni\libs folder. You should create a different folder for different architecture within JNI like armeabi,x86 etc and place the corresponding .so files in these folders. I am not sure if you are using Android studio or eclipse. In eclipse, automatically libs are created under corresponding folder and in Android studio you might have to place them manually for all of them to be included in the final apk – G3M Aug 28 '14 at 17:40

1 Answers1

1

For eclipse users,only two steps needed: 1. Set Library project by right-click on lib project name --> properties --> Android --> Mark "Is Library" checkbox. Step 1

2.In the project use the shared object, add a reference to the libraray project by right-click on project name --> properties --> Android --> Library/"Add". Step 2 After you build the project ,the result apk file would include those .so libs.

zionpi
  • 2,593
  • 27
  • 38