Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

java.lang.UnsatisfiedLinkError: Native method not found: com.mapbox.mapboxsdk.net.NativeConnectivityListener.initialize #13045

Closed
Xgamefactory opened this issue Oct 8, 2018 · 16 comments
Labels
Android Mapbox Maps SDK for Android needs information

Comments

@Xgamefactory
Copy link

We are getting crash with error

 FATAL EXCEPTION: main
    Process: com.fersmart.maps.nav.nativemapnavtestapp, PID: 2492
    java.lang.UnsatisfiedLinkError: Native method not found: com.mapbox.mapboxsdk.net.NativeConnectivityListener.initialize:()V
        at com.mapbox.mapboxsdk.net.NativeConnectivityListener.initialize(Native Method)
        at com.mapbox.mapboxsdk.net.NativeConnectivityListener.<init>(NativeConnectivityListener.java:27)
        at com.mapbox.mapboxsdk.net.ConnectivityReceiver.instance(ConnectivityReceiver.java:40)
        at com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:60)
@ansis ansis added the Android Mapbox Maps SDK for Android label Oct 8, 2018
@tobrun
Copy link
Member

tobrun commented Oct 9, 2018

Thank you for reaching out @Xgamefactory,
which version of the SDK were you using?
could you provide a minimal reproducible example?

@florianPOLARSTEPS
Copy link

florianPOLARSTEPS commented Nov 27, 2018

@tobrun I am seeing this one now as well in our production app for a limited set of users quite frequently.

Mapbox SDK Version: 6.7.1
Distribution: .aab

Device distribution

Could be related to? #13448

@LukasPaczos
Copy link
Member

Most likely not related to #13448 as it's targeting a different architecture. Are you able to reproduce locally by any chance @florianPOLARSTEPS? You can have the .so library load failure re-thrown by enabling strict mode with MapStrictMode.setStrictModeEnabled(true) or just search for a "Failed to load native shared library." log.

@florianPOLARSTEPS
Copy link

I tried your suggestions but unfortunately could not reproduce on one of the devices I saw that issue happening in production. It also only happens to a very limited set of users ( 50 distinct users for the screenshot above ) upon app startup whereas on the same devices a huge number of users have no problem at all. Unfortunately Google play does not have any more valuable information available for diagnostics. It could very well be an issue in google play's dynamic delivery system.

@LukasPaczos
Copy link
Member

Thanks for looking into this @florianPOLARSTEPS. Unfortunately, I wasn't able to reproduce locally either. Please keep us posted if you happen to find some more information.

@tobrun
Copy link
Member

tobrun commented Nov 29, 2018

@florianPOLARSTEPS this could be an issue related to general so file loading. I would advice you to look into an external library loader as https://github.com/KeepSafe/ReLinker or https://github.com/facebook/SoLoader, you can use these libraries in conjunction with our LibraryLoader.java class.

@P-Zenker
Copy link

P-Zenker commented Jan 23, 2019

I've updated one of my apps from:

  • mapbox-android-navigation-ui:0.24.1
  • uploaded as APK

to

  • mapbox-android-navigation-ui:0.26.0
  • uploaded as Android App Bundle

There are now a few UnsatisfiedLinkError exceptions in my application on a
GI-I9500_TMMARS with Android 5.1:

Fatal Exception: java.lang.UnsatisfiedLinkError: 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__)
       at com.mapbox.mapboxsdk.net.NativeConnectivityListener.initialize(NativeConnectivityListener.java)
       at com.mapbox.mapboxsdk.net.NativeConnectivityListener.<init>(NativeConnectivityListener.java:27)
       at com.mapbox.mapboxsdk.net.ConnectivityReceiver.instance(ConnectivityReceiver.java:40)
       at com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:60)
       at myapp.CUApplication.onCreate(CUApplication.java:52)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4577)
       at android.app.ActivityThread.access$1500(ActivityThread.java:156)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1369)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5278)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

CUApplication.java:52 is just:
Mapbox.getInstance(this, getString(R.string.mapbox_access_token));

Before my update I never saw this issue before and I couldn't reproduce it

@LukasPaczos
Copy link
Member

@P-Zenker have you tried using any of the libraries mentioned by Tobrun in #13045 (comment)? The issue most likely stems from the default library failing to do its job. You can use LibraryLoader#setLibraryLoader to provide an alternative, see the setup in our test app.

@bundeeteddee
Copy link

Hi @LukasPaczos , we have also just started seeing this UnsatisfiedLinkError error after turning on app bundle (almost identical to @P-Zenker). We have seen very minimal crashes before that, it has jumped quite a bit since then (from ~30 to ~500 crashes in our release cycle).

I have tried using a different .so library loader, the SOLoader from facebook but that is not making any difference in crash rate. I havent tried using ReLinker though, potentially something i can test with next.

We are currently using sdk v6.6.

@tobrun
Copy link
Member

tobrun commented Jan 23, 2019

Thank you for adding that additional information @bundeeteddee, do you have some more information on which devices this is occurring? do you have any additional configuration setup in terms of ABI exclusion?

@bundeeteddee
Copy link

No worries! There does not seem to be any patterns emerging in terms of devices and android version. Here is the snapshot of the latest release (sample size of ~900 crashes through few release cycles):

sample

In this release we excluded ABI.

@bundeeteddee
Copy link

bundeeteddee commented Jan 27, 2019

Update: we have done a few more trials and found out the library loader actually works. I had carelessly set the library after attempting to setup mapbox. Ugh.

Using SOLoader, before calling 'getInstance' on mapbox works well. It does not 100% remove all the 'unsatisfiedLink' crashes, but it brings it back to pre-appbundling level of crashes instead, a lot less of them.

👍

@florianPOLARSTEPS
Copy link

@florianPOLARSTEPS this could be an issue related to general so file loading. I would advice you to look into an external library loader as https://github.com/KeepSafe/ReLinker or https://github.com/facebook/SoLoader, you can use these libraries in conjunction with our LibraryLoader.java class.

We released an update with SoLoader as library loader and the issue seems to be fixed. Thx

@tobrun
Copy link
Member

tobrun commented Feb 24, 2019

Adding here that starting with 7.3.0, we will ship relinker as the default library loader

@dabitdev
Copy link

@tobrun I am getting this crash on minsDK 26 and using
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.0'

@dabitdev
Copy link

should we reopen this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android needs information
Projects
None yet
Development

No branches or pull requests

8 participants