mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Many Fatal Exception: java.lang.UnsatisfiedLinkError

Open ben-j69 opened this issue 7 years ago • 10 comments

**Android versions:**6.0.1 Device models: Nexus 5X Mapbox SDK versions: implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.2.0' implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:4.5.0' implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:0.5.0' implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.33.2' implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.33.2'

I have just added crashlytics to my app and I got this new error from the sdk : No implementation found for void com.mapbox.mapboxsdk.net.NativeConnectivityListener.initialize() (tried Java_com_mapbox_mapboxsdk_net_NativeConnectivityListener_initialize and Java_com_mapbox_mapboxsdk_net_NativeConnectivityListener_initialize__)

com.mapbox.mapboxsdk.net.NativeConnectivityListener.initialize (NativeConnectivityListener.java) com.mapbox.mapboxsdk.net.NativeConnectivityListener. (NativeConnectivityListener.java:27) com.mapbox.mapboxsdk.net.ConnectivityReceiver.instance (ConnectivityReceiver.java:43) com.mapbox.mapboxsdk.Mapbox.getInstance (Mapbox.java:60)

I have several crashes each day on my app and it is affecting my user, we need a solution please.

fail

ben-j69 avatar Apr 15 '19 12:04 ben-j69

This could potentially come from mismatching dependency versions. Below a list of the dependencies that match versions:

implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.1'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:4.6.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:0.6.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.35.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.35.0'

Would you be able to test with this setup?

tobrun avatar Apr 16 '19 14:04 tobrun

I will try it but before to go live it will take 2 weeks

ben-j69 avatar Apr 17 '19 09:04 ben-j69

Hello @tobrun

I use your configuration and now I have this error

com.getkeepsafe.relinker.ApkLibraryInstaller.installLibrary (ApkLibraryInstaller.java:128) com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal (ReLinkerInstance.java:180) com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary (ReLinkerInstance.java:136) com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary (ReLinkerInstance.java:92) com.mapbox.mapboxsdk.module.loader.LibraryLoaderProviderImpl$ReLinkerLibraryLoader.load (LibraryLoaderProviderImpl.java:38) com.mapbox.mapboxsdk.LibraryLoader.load (LibraryLoader.java:43) com.mapbox.mapboxsdk.net.NativeConnectivityListener. (NativeConnectivityListener.java:1) com.mapbox.mapboxsdk.net.ConnectivityReceiver.instance (ConnectivityReceiver.java:43) com.mapbox.mapboxsdk.Mapbox.getInstance (Mapbox.java:60)

ben-j69 avatar May 02 '19 19:05 ben-j69

Hello I still have this error it is not satisfying at all

ben-j69 avatar Sep 18 '19 12:09 ben-j69

Are you using any kind of abi split configuration? which packaging format are you using? Are you using any other native libraries yourself or through dependencies? How many percent of users are impacted?

note that you are able to replace the native library loader by any your own choice with LibraryLoader#setLibraryLoader

tobrun avatar Sep 18 '19 12:09 tobrun

I don't think I am using any abi split configuration. Do you have more infos ?

I am using app bundles.

I have other native libs like bugsnag for example.

Around 1% of my user have this error, this is the most common error in my app and it is why I really need to fix it.

ben-j69 avatar Sep 18 '19 12:09 ben-j69

@ben-j69 Because Mapbox only has 4 lib folder is:

"armeabi-v7a", "arm64-v8a", "x86", "x86_64"

You can see in APK analyze: https://i.ibb.co/zXyjwjD/Screenshot-from-2020-02-14-00-31-08.pngScreenshot from 2020-02-14 00-31-08

But some device will find Mapbox class in wrong path, example it find in folder "armeabi", because this folder not exists so UnsatisfiedLinkError will be throw.

Have to solve? You have to tell to device that it should find Mapbox lib in there folders:

"armeabi-v7a", "arm64-v8a", "x86", "x86_64"

by add filter to build.gradle in app module:

defaultConfig {
       ...
       ndk {
           abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
       }
}

in some case you also have to add this line to file gradle.propertise :

android.useDeprecatedNdk=true

Notes: I see that some device x86 only run well when set to:

ndk { abiFilters "x86" }

so I think we should built multi apk abi

caovanthanh203 avatar Feb 13 '20 17:02 caovanthanh203

On circle CI, updating from mapbox 8.4.0 to version 9.0.0 I had to add

ndk { abiFilters "x86" }

to make it work, thanks.

ben-j69 avatar Feb 26 '20 08:02 ben-j69

I confirm the solution given by @bc67da8d works with this config : implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.1.3'

Only needed to add in app.gradle :

ndk {
      abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
  }

My source code is from Nativescript app, with the following conf :

  • Nativescript : 6.2.2
  • tns-core-modules : 6.1.0
  • tns-android : 6.2.0

GrEg00z avatar Jan 26 '21 11:01 GrEg00z

I am getting the same error with implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.0.0'

No additional dependencies are used for mapbox.

Previous version worked on 8.0.1

Lizzergas avatar Oct 13 '22 12:10 Lizzergas