Search code examples
androidandroid-app-bundlevitamio

App with native libs distributed as AppBundle does not work but as an APK it works


I have this Android app using an old video player library called Vitamio. Vitamio has not been updated for ages however it does work, at least until recently.

The library (and the app) works fine when compiled into an ordinary APK but if I create an App Bundle, I get a crash due to "java.lang.UnSatisfiedLinkError" when running the app on the phone. The Google PlayConsole does not give me any errors nor warnings. As a test, I set "enableSplit = false" for "abi" in the app build.gradle file but there was no difference.

It seems strange that when compiling to an AppBundle, it would mess up things so previous compilations as an APK do not work any longer.

Anyway, I could fix this?


Solution

  • The APKs generated from the App Bundle leave native libraries uncompressed in the APK so they're not extracted at installation on the device, thus saving space on the device. Depending how you load the native libraries, this can lead to this exception.

    Ensure you use the Android standard way of loading native libraries. If you can't for any reason, then you can disable this feature using android.bundle.enableUncompressedNativeLibs=false in the gradle.properties file. At the cost of a bigger app for your users.

    If you don't use Gradle to build the bundle, the information about the compression of native libraries is stored in the BundleConfig.pb inside the bundle (which is passed to bundletool by the build system). See https://github.com/google/bundletool/blob/master/src/main/proto/config.proto#L77