2

I am using compileSdkVersion 28 and included some prebuilt executable native .so files in Android Studio.

After Building .aab Bundle and generating universal apk from bundle tool locally everything seems to works OK and all native .so files are extracted to /data/app/com.example/lib/armv64-v8a/library.so

But when uploading the bundle to the Play Store or generating apk splits locally and installing it again to my device the .so files are not extracted anymore!

I have added too in my build.gradle:

ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'

and in the app manifest:

android:extractNativeLibs="true"

Also, I am using SplitCompatApplication and override it in Application Class and declared in manifest too.

UPDATE

I just noticed that Android doesn't extract native libs in Normal App too when using bundle. My device is Android 9 (arm64-v8a, armeeabi-v7a)

Here I have attached the simple project

https://ufile.io/7ih0rgs0

UPDATE 1

I just found that if we add this to the gradle.properties it works very fine but I don't know why. I think it is definitely a bug!

This command to gradle.properties solve the issue : android.bundle.enableUncompressedNativeLibs=false

Just reading another bug in Google Issue Tracer and found that this solves this problem for the moment. Bug: https://issuetracker.google.com/issues/127691101

UPDATE 2

If we start using SplitCompatApplication and trying to download and install Dynamic Feature Module On Demand, after it success installing doesn't extract native .so libs to data/app/com.example/libs/arm64-v8a/libexample.so

After some research i found that after installing Dynamic Feature Module On Demand i see some files in : data/data/com.example/files/splitcompat/1000/native-libs/libexample.so

Is this Bug or why this happens? And is there any easy way to access native libs files (e.x copy to another dir)?

Also, in meantime with new Android Q release removed execute permission for app home directory. So it is very important for this native executable libraries to be extracted directly into /data/app/com.example/libs/libexample.so to works fine for new Android Q.

So this issue happens only when uploading bundle.aab to the Play Store and installing on demand module. If we try to install app and modules locally (offline) from bundle tool everything works OK, native libraries extracted to the right directory

How to deal with this?

EAK TEAM
  • 5,726
  • 4
  • 30
  • 52
  • `System.loadLibrary()` should work just the same for non-extracted native libs. If you need to **dlopen()** them, life becomes a bit tricker, but even if `dlopen("/path/to/MyApp.apk!libfoo.so", ...)` does not work for you, [android_dlopen_ext()](https://developer.android.com/ndk/reference/group/libdl) comes to resque. – Alex Cohn Jun 24 '19 at 10:42

0 Answers0