0

I have one android myLibrary.jar file. But myLibrary.jar file will load the native 3 different so file. I have a.so, b.so and c.so.

When i using in my own application, it just simply put the jar file to the Android Dependencies and all 3 so files put in the libs/armeabi of the main application package.

When deploy and install on the device, these so file will be in the data/data/my-appname/lib/*.so.

Now i need to provide the sdk solution. The user side doesn't want the main application. They just want the myLibrary.jar. So i am considering about packing all 3 *.so files to the jar. I searched for the how to add to the so files to myLibrary.jar. But i still don't understand.

In this following post: [Ant]How to add .so file into a jar and use it within jar(set the java.library.path)?

It mentioned about adding the so file to the jar and extract at runtime. But i still don't understand how to achieve that.

After trying that mentioned in the following post:

Creating a product SDK: How do I add a native lib (.so) and a jar with the SDK I am creating?

After my sample application reference the the compiled jar that included the .so file. After installing to the device, the libs/armeabi/xxx is not unpacked on the install. So i would like to know how to extract them dynamically and save them to data/data/my-appname/lib/ so that i can use with System.loadlibary(.so).

Thanks a lot.

Community
  • 1
  • 1
rodent_la
  • 1,195
  • 4
  • 18
  • 38
  • Check my answer, maybe it help you, http://stackoverflow.com/a/33164947/3626214 – Aspicas Mar 22 '16 at 09:36
  • [this guy](https://github.com/OnlyInAmerica/Android-JNI-Gradle/blob/master/jni/ndk-build.sh) created a jar for each *.so – vault Mar 22 '16 at 15:50
  • anyway, I don't know if it works, but I'd create an android library project and provide that as a dependency – vault Mar 22 '16 at 15:51
  • My problem is like this one. https://groups.google.com/forum/#!topic/android-ndk/u1v64AapyKI http://stackoverflow.com/questions/4882167/creating-a-product-sdk-how-do-i-add-a-native-lib-so-and-a-jar-with-the-sdk-i This will not be automatically unpacked on install. You will need to write code to extract it from your APK file into your data directory, then use System.load on the .so file in your data directory. Now i don't know how to extract from the apk file during execution. – rodent_la Mar 24 '16 at 09:24

0 Answers0