mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

Many Fatal Exception: java.lang.UnsatisfiedLinkError #14428

Closed ben-j69 closed 5 years ago

ben-j69 commented 5 years ago

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

tobrun commented 5 years ago

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?

ben-j69 commented 5 years ago

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

ben-j69 commented 5 years ago

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 commented 5 years ago

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

tobrun commented 5 years ago

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

ben-j69 commented 5 years ago

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.

caovanthanh203 commented 4 years ago

@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

ben-j69 commented 4 years ago

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.

GrEg00z commented 3 years ago

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 :

Lizzergas commented 1 year ago

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