I'm publishing an app using the new app bundle format (aab). The app includes some native libraries for armeabi-v7a. When I install the app through Google Play on an arm64-v8a architecture it doesn't include native libraries for which there's no arm64-v8a so file.
According to this https://stackoverflow.com/a/39622499/534471, a armeabi-v7a library should run on an arm64-v8a device (and it works fine when installed through adb so it does work indeed).
The Google Play console shows the different apks by architecture, screen density etc. From the apk sizes I can clearly tell which ones don't include the native libraries. I also use a native libs monitor app to analyze the installed apk and it clearly doesn't include the native libraries I need (it includes arm64-v8a native libraries if the app has an arm64-v8a so file but not if there's only an armeabi-v7a version).
My gradle build file includes this small piece of code for bundle configuration:
bundle {
language {
enableSplit = false
}
density {
enableSplit = true
}
abi {
enableSplit = true
// include 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
Now here's my question: is there a way to tell the build tool to include the "next best" native library in each apk, next best being the closest version that would run on a specific architecture?
PS: If I set enableSplit = false for the abi then it will include the native library (as expected) but unfortunately for all platforms including x86 which alone is 20MB big...
For those who haven't seen how Google Play splits the app bundle into apks, here's a screenshot:
There's no need to tell the tooling to serve the next best, that should be done automatically. If the device reports to also support armeabi-v7a, it should receive the APK that contains it.
Edit:
Given your screenshot, it seems that your app provides native libraries for the arm64-v8a
architecture, so the arm64-v8a
libraries will be served and not the armeabi-v7a
ones.
Note also that one device is not able to load libraries from different architectures for the same app, i.e. you can't expect that some libraries be loaded in 64 bits and some others in 32 bits. Even with a "fat" APK containing all ABIs, the Android platform will only select one ABI upon installation of your app and discard all the other files, so from the moment you provide at least one library for arm64-v8a
, none of the armeabi-v7a
libraries will ever be loaded on an arm64-v8a
device.
Edit:
You should consider excluding some ABIs from your app if you can't provide the required native libraries for that architecture. This can be achieved using the abiFilters
block in the gradle config:
ndk { abiFilters 'armeabi-v7a', 'x86' }
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