mapbox / mapbox-gl-native-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
218 stars 114 forks source link

App bundle and UnsatisfiedLinkError #416

Open tobrun opened 4 years ago

tobrun commented 4 years ago

We have received a numerous reports related to

java.lang.UnsatisfiedLinkError: No implementation found for void com.mapbox.mapboxsdk.net.NativeConnectivityListener.initialize()

The Mapbox Maps SDK for Android, isn’t the only library facing this issue as the root cause seems related to the App Bundle format that Google introduced in 2018. There are a couple of hypothesis/solutions from equivalent threads of different Android libraries using native code:

Potential solution one:

https://github.com/facebook/react-native/issues/23764#issuecomment-530801648

android {
    packagingOptions {
        pickFirst '**/armeabi-v7a/libmapbox-gl.so'
        pickFirst '**/x86/libmapbox-gl.so'
        pickFirst '**/arm64-v8a/libmapbox-gl.so'
        pickFirst '**/x86_64/libmapbox-gl.so'
        pickFirst '**/x86/libmapbox-gl.so'
    }
}

Potential solution two:

https://github.com/facebook/react-native/issues/23764#issuecomment-558139269

Android App Bundle has the native libraries uncompressed. You can add the following configuration to your gradle.properties to revert back to compressing:

android.bundle.enableUncompressedNativeLibs=false

I would love to see if someone from the community can try any of the proposed solutions:

cc @mapbox/maps-android

JRWilding commented 4 years ago

solution 2 does not work, we see the issue with android.bundle.enableUncompressedNativeLibs = false defined

almo-ltoeroek commented 4 years ago

+1 this is currently forced to revert using APK which results in much larger app footprint

eygraber commented 3 years ago

We started seeing this issue after updating to v9.5.0

Before that this crash never occurred. We use an aab.

The crash seems to only be happening on Android 24-26 and on Samsung devices.

We use:

override fun attachBaseContext(base: Context) {
    super.attachBaseContext(base)
    SplitCompat.install(this)
}

in our Application, so the install should have all the pieces it needs to run.

eygraber commented 3 years ago

We now see this on all Android versions that we support (24-30) and most popular manufacturers. We call Mapbox.getInstance in an androidx.startup.Initializer (and before that we were calling it from a ContentProvider), and Application.attachBaseContext should be getting run before that, so SplitCompat.install should guarantee that the installation is valid.

The suggested solutions have not helped.

eygraber commented 3 years ago

Still happening on 9.6.1 although it seems like it only happens when initially uploading the aab to the Play Store. Maybe it's an issue in the device farm that Google uses for testing app updates?