1

I'm working on some script for custom build system and i need to pack some .so files in android apk (aars with native libs are not yet supported).

I've invoked ./gradlew assembleDebug --debug for the apk project that depends on aar with native libraries (.so) to get full log but did not find any .so files paths passed to aapt or any other android build tool (though i've seen .so stripping commands with ndk strip tool).

How is it done in details? Does aapt tool do it? Are there any aapt arguments for this or they should be just stored on some specific paths (eg. libs).

plum 0
  • 652
  • 9
  • 21
4ntoine
  • 19,816
  • 21
  • 96
  • 220

1 Answers1

0

Yes, aapt via an invocation like aapt add -v MyApp.apk lib/armeabi/libMyLib.so.

Use aapt --list MyApp.apk to ensure that it is in the apk with that directory structure (a lib folder, an armeabi subfolder, and MyApp.apk within that).

After installing the app, look in /data/app/com.Company/android/MyApp-X/lib/arm/ for libMyLib.so to ensure it got copied.

If problems, logcat output is actually really useful, telling you the path tried, the function tried, etc.

Obviously, replace the app name, company name, and armeabi architecture to fit your projects' parameters.