mapbox-maps-android
mapbox-maps-android copied to clipboard
Sporadic crashes when Mapbox library is loaded: java.lang.UnsatisfiedLinkError at com.mapbox.common.loader.MapboxLibraryLoader.load
Environment
- Android OS version: Android 11
- Devices affected: 83% Samsung, 17% Google
- Maps SDK Version:
implementation "com.mapbox.maps:android:10.1.0"
implementation "com.mapbox.mapboxsdk:mapbox-sdk-turf:5.8.0"
Observed behavior and steps to reproduce
Sporadic crashes reported via crashlytics when loading Mapbox libraries.
Expected behavior
No crashes.
Notes / preliminary analysis
Additional links and references
Stack trace
java.lang.RuntimeException:
at android.app.ActivityThread.installProvider (ActivityThread.java:7769)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:7309)
at android.app.ActivityThread.handleMakeApplication (ActivityThread.java:7166)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7134)
at android.app.ActivityThread.access$1500 (ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2102)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8167)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)
Caused by: androidx.startup.StartupException:
at androidx.startup.AppInitializer.doInitialize (AppInitializer.java:162)
at androidx.startup.AppInitializer.discoverAndInitialize (AppInitializer.java:198)
at androidx.startup.InitializationProvider.onCreate (InitializationProvider.java:38)
at android.content.ContentProvider.attachInfo (ContentProvider.java:2113)
at android.content.ContentProvider.attachInfo (ContentProvider.java:2087)
at android.app.ActivityThread.installProvider (ActivityThread.java:7764)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:7309)
at android.app.ActivityThread.handleMakeApplication (ActivityThread.java:7166)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7134)
at android.app.ActivityThread.access$1500 (ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2102)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8167)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)
Caused by: java.lang.UnsatisfiedLinkError:
at java.lang.Runtime.loadLibrary0 (Runtime.java:1067)
at java.lang.Runtime.loadLibrary0 (Runtime.java:1007)
at java.lang.System.loadLibrary (System.java:1667)
at com.mapbox.common.loader.MapboxLibraryLoader.load (MapboxLibraryLoader.kt:19)
at com.mapbox.common.MapboxSDKCommonInitializer.create (MapboxSDKCommonInitializer.kt:62)
at com.mapbox.common.MapboxSDKCommonInitializer.create (MapboxSDKCommonInitializer.kt:11)
at androidx.startup.AppInitializer.doInitialize (AppInitializer.java:155)
at androidx.startup.AppInitializer.discoverAndInitialize (AppInitializer.java:198)
at androidx.startup.InitializationProvider.onCreate (InitializationProvider.java:38)
at android.content.ContentProvider.attachInfo (ContentProvider.java:2113)
at android.content.ContentProvider.attachInfo (ContentProvider.java:2087)
at android.app.ActivityThread.installProvider (ActivityThread.java:7764)
at android.app.ActivityThread.installContentProviders (ActivityThread.java:7309)
at android.app.ActivityThread.handleMakeApplication (ActivityThread.java:7166)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7134)
at android.app.ActivityThread.access$1500 (ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2102)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8167)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)
Seems it's the same issue with library loading as https://github.com/mapbox/mapbox-gl-native-android/issues/416
We've started to get this exception lately as well. Here are the details, I hope it helps: Stack trace:
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/package-name-VCfnYXvvcgeoxfVicOChTA==/base.apk"],nativeLibraryDirectories=[/data/app/package-name-VCfnYXvvcgeoxfVicOChTA==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libmapbox-common.so"
at android.app.ActivityThread.installProvider(ActivityThread.java:6242)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/package-name-VCfnYXvvcgeoxfVicOChTA==/base.apk"],nativeLibraryDirectories=[/data/app/package-name-VCfnYXvvcgeoxfVicOChTA==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libmapbox-common.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
at java.lang.System.loadLibrary(System.java:1657)
at com.mapbox.common.loader.MapboxLibraryLoader.load(MapboxLibraryLoader.kt:6)
at com.mapbox.common.CoreInitializer.create(CoreInitializer.kt:2)
at com.mapbox.common.CoreInitializer.create(CoreInitializer.kt:1)
at wj.b(AppInitializer.java:88)
... 17 more
So far we faced this issue on 2 devices repeatedly:
- Android 8.1.0; Nexus 5X on January 23
- Android 7.1.2; SM-T555 on January 18
Dependency details:
implementation("com.mapbox.maps:android:10.10.0") {
exclude(group = "com.mapbox.plugin", module = "maps-compass")
exclude(group = "com.mapbox.plugin", module = "maps-attribution")
exclude(group = "com.mapbox.plugin", module = "maps-scalebar")
exclude(group = "com.mapbox.plugin", module = "maps-overlay")
exclude(group = "com.mapbox.plugin", module = "maps-locationcomponent")
exclude(group = "com.mapbox.plugin", module = "maps-viewport")
}
Also spiking for us now rapidly from today on:
Fatal Exception: java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dlopen failed: library "libmapbox-common.so" not found
at android.app.ActivityThread.installProvider(ActivityThread.java:8215)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7746)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7566)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2177)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
~80% of that crash are on Android 11 where 80% is Samsung Galaxy A12 atm. We use mapbox 10.6.0.
We're getting the same error and we use mapbox 10.10.0.
Still an issue at 10.11.0.
Hi! I'm getting this error more and more often. Yesterday I pushed an update to users and it started to happen even more often than before. Please see the image.
I'm using these Mapbox dependencies:
com.mapbox.mapboxsdk:mapbox-sdk-services:6.10.0
com.mapbox.maps:android:10.10.1



@alingocab Have you released an app with crashlytics 18.3.0 (or higher) recently?
@jush I'm using com.google.firebase:firebase-bom:31.2.1. As I can see, firebase-bom:31.2.1 is using crashlytics 18.3.5.
Thanks, Crashlytics release 18.3.0 introduced this change that might explain why you see it more often:
Improved crash reporting reliability for crashes that occur early in the app's lifecycle
Ok. It is very good that I can see it, but the main issue is that the app is actually crashing with this error. I can see a huge number of crashes generated by some of the devices like Nexus 5x, Samsung Galaxy S9+ etc.
I will attach full crash details from Firebase.
Same issue here as well. Crash log looks just like the one posted by alingocab as well as the OP.
I also observe these crashes after migrating from v9 to v10.

Hello. Yesterday we updated com.mapbox.maps:android to 10.11.1. Still, those crashes started to flow immediately after update. Please see the screenshot attached. It would be very helpful if someone from Mapbox team can provide a solution to this. This thread has been started more than 1 year ago and still no practical response. Thanks in advance.

Same issue here as well after the v9 ->v10 migration, currently on v10.11.1
Same issue here, current version 10.8.0
i have the same problem
Same here. Has there been any resolution?
Update mabox sdk to 10.12.0 today, issue still present, a lot of crashes coming up. Seems like this crash is not important for mapbox team...
Also seeing this issue since using Crashlytics 18.3.0+, but I have not physically seen the crash myself, nor have I received a "startup crash" report from our beta testers or Play Store users. Perhaps it is either a 'silent' crash, or happens only once per user and they assume nothing of it?
I have the same crash with device Nexus 5X 8.1.0 while Mapbox Android is 10.12.0
I have the same crash with device Nexus 5X 8.1.0 while Mapbox Android is 10.12.0
For me this is the same: while there are only 3 users having this crash, they're all on a Nexus 5x with Android 8.1.0
I have the same crash with device Nexus 5X 8.1.0 while Mapbox Android is 10.12.0
For me this is the same: while there are only 3 users having this crash, they're all on a Nexus 5x with Android 8.1.0
The reason you see Nexus 5x is because that's a device used by Google to run some tests on your app before pushing it to Google Play. In my case, beside this Nexus 5x I see a lot of other devices owned by real users.
It's interesting. But there are also some crashes on the Galaxy devices.
Could you please check if following helps?
In my case I don't remove any initialization providers, so the solution above won't help I believe. Merged manifest file also looks fine IMO:
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="com.myapp.androidx-startup"
android:exported="false" >
<meta-data
android:name="com.mapbox.maps.loader.MapboxMapsInitializer"
android:value="androidx.startup" />
<!-- This entry makes MapboxSDKCommonInitializer discoverable. -->
<meta-data
android:name="com.mapbox.common.MapboxSDKCommonInitializer"
android:value="androidx.startup" />
<meta-data
android:name="androidx.emoji2.text.EmojiCompatInitializer"
android:value="androidx.startup" />
<meta-data
android:name="androidx.lifecycle.ProcessLifecycleInitializer"
android:value="androidx.startup" />
</provider>
I still didn't receive any complaints from users, and most of the cases happen in the background:

Maybe this will give you some clues for investigation: I have two separate processes in the app. So the hypothesis is this initialization issue happens in the second process, which doesn't interact with Mapbox and doesn't provide any UI (and that's probably why there are no complaints from users).
Still an issue at 10.12.2

There is similar issue in https://github.com/mapbox/mapbox-android-demo/issues/1280
we can add these config into app's build.gradle
packagingOptions {
pickFirst '/armeabi-v7a/libmapbox-common.so'
pickFirst '/x86/libmapbox-common.so'
pickFirst '/arm64-v8a/libmapbox-common.so'
pickFirst '/x86_64/libmapbox-common.so'
pickFirst '**/x86/libmapbox-common.so'
}
Could you please check if following helps?
The above workaround initially made a lot of sense to us but unfortunately it did not work for us. After applying this, the stack trace has changed. Now we can see that the initialization is explicitly called within our Application class but immediately after that the app crashes with the same reason.
Unfortunately, solution from @leanh128 didn't help me either. Currently using 10.14.0-beta.1.