I switched to Android App Bundle (ABB) in Google Play production few months ago and released couple updates - things were fine. Last week I took Android Studio update and noticed that ONLY the ABB build fails to load one of my native library at runtime. However APK build (release) and debug build is loading the native library fine.
I was forced to deploy an APK to replace the broken ABB release in production.
I found the ABB package contains all four (arm64-v8a, armeabi-v7a, x86, x86_64) directories and all my .SO files are in there (same as in the APK package).
For further investigation, I edited the Android Studio Run Configuration to deploy 'APK from app bundle' and verified the native library is failing to load for ABB build only (other build modes are fine).
My environment: Android Studio 4.0 (latest at the moment), 'io.fabric.tools:gradle:1.28.0' (ABB worked until 1.26.1), compileSdkVersion 28, buildToolsVersion '28.0.3'
There is no easy way to rollback latest update. Please let me know how to fix this build issue. Appreciate your help.
Finally found the workaround to resolve this issue. The third-party library that I am using is not compliant with the recent Gradle change. Java code of the library doesn't know the right path to it's SO file when an APK is constructed from ABB on a device. Setting in the gradle.properties file works well.
According to the Gradle release note
When building an Android App Bundle, APKs generated from that app bundle that target Android 6.0 (API level 23) or higher now include uncompressed versions of your native libraries by default. This optimization avoids the need for the device to make a copy of the library and thus reduces the on-disk size of your app. If you'd rather disable this optimization, add the following to your gradle.properties file:
android.bundle.enableUncompressedNativeLibs = false
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