mapbox / mapbox-android-demo

Google Play demo app for the Mapbox Maps SDK for Android
https://play.google.com/store/apps/details?id=com.mapbox.mapboxandroiddemo
BSD 2-Clause "Simplified" License
719 stars 493 forks source link

Apk splits results in unsatisfiendlinkerror when uploaded to Google Play #374

Open tobrun opened 7 years ago

tobrun commented 7 years ago

The currently active beta track apk v71 crashes when opening a MapView. Source is either apk split #288 or a proguard issue. We need to fix this to be able to release an update for https://github.com/mapbox/mapbox-gl-native/issues/9315.

06-22 19:53:07.310 3869-3869/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.mapbox.mapboxandroiddemo, PID: 3869
                                                 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mapbox.mapboxandroiddemo-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mapbox.mapboxandroiddemo-2/lib/arm64, /system/lib64, /vendor/lib64]]] couldn't find "libmapbox-gl.so"
                                                     at java.lang.Runtime.loadLibrary0(Runtime.java:984)
                                                     at java.lang.System.loadLibrary(System.java:1562)
                                                     at com.mapbox.mapboxsdk.net.NativeConnectivityListener.<clinit>(Unknown Source)
                                                     at com.mapbox.mapboxsdk.net.ConnectivityReceiver.instance(Unknown Source)
                                                     at com.mapbox.mapboxsdk.Mapbox.getInstance(Unknown Source)
                                                     at com.mapbox.mapboxandroiddemo.examples.basics.SimpleMapViewActivity.onCreate(Unknown Source)
                                                     at android.app.Activity.performCreate(Activity.java:6682)
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
                                                     at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:154)
                                                     at android.app.ActivityThread.main(ActivityThread.java:6121)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

cc @langsmith @zugaldia

tobrun commented 7 years ago

For now I have disabled apk split to be able to ship a release containing v5.1.0-beta.5 in https://github.com/mapbox/mapbox-android-demo/pull/381.

langsmith commented 6 years ago

Is this still an issue @tobrun ? Still needs to be addressed? Ticket can be closed?

tobrun commented 6 years ago

I don't think we have re-enabled integration for it as the demo app size is 30.14mb, would be great getting this in as this is the the only test with apk-split we have.

ArLabDev commented 6 years ago

I have the same crash on my App and mapboxsdk 5.1.3. I cannot replicate it, but I have about 50 crash reports in firebase, the last of december 2017. All reports on API 23 and on few devices (quite uncommon: FEVER, CUBOT, Acer T11 and other four)

I do not use ApkSplit, but I use abiFilters "armeabi-v7a", "x86" to reduce .apk size

What I understand from the Exception is that it's trying to find a 64 bit native library, but it does not find it. It's quite strange, because all devices reporting the crash supports armeabi-v7a and so they should load it. I tested the App with several devices, boht x86 and Arm and it seems to work fine (except that on few devices that I do not have to test on)

zugaldia commented 6 years ago

@ArLabDev any chance that you could share the relevant part of your crash log on this ticket?

ArLabDev commented 6 years ago

I'm not able to reproduce the crash. It seems to happens only on few uncommon devices. I see it in firebase report.

The only "relevant" part of the crash I can share is a (not complete) list of the devices: FEVER 11 times CUBOT MAX 7 times Apollo lite 6 times X5max_PRO 3 times X7pro, Upad Pro, T11, Lenovo A7700, CUBOT MANITO, ...

And the stack trace that is very similar to the one reported by you.

Exception java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/mnt/expand/5538a1c1-4225-4890-b6ca-31d19c3a879a/app/com.arlabsmobile.altimeterfree-1/base.apk"],nativeLibraryDirectories=[/mnt/expand/5538a1c1-4225-4890-b6ca-31d19c3a879a/app/com.arlabsmobile.altimeterfree-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "[REDACTED_DOMAIN_NAME]" java.lang.Runtime.loadLibrary (Runtime.java:367) java.lang.System.loadLibrary (System.java:1076) com.mapbox.mapboxsdk.net.NativeConnectivityListener.<clinit> (NativeConnectivityListener.java:9) com.mapbox.mapboxsdk.net.ConnectivityReceiver.instance (ConnectivityReceiver.java:37) com.mapbox.mapboxsdk.Mapbox.getInstance (Mapbox.java:61) com.arlabsmobile.altimeter.MapsFragment.onCreate (MapsFragment.java:616) android.support.v4.app.Fragment.performCreate (Fragment.java:2180) android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1244) android.support.v4.app.FragmentTransition.addToFirstInLastOut (FragmentTransition.java:1085) android.support.v4.app.FragmentTransition.calculateFragments (FragmentTransition.java:976) android.support.v4.app.FragmentTransition.startTransitions (FragmentTransition.java:95) android.support.v4.app.FragmentManagerImpl.executeOpsTogether (FragmentManagerImpl.java:2146) android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps (FragmentManagerImpl.java:2103) android.support.v4.app.FragmentManagerImpl.execPendingActions (FragmentManagerImpl.java:2013) android.support.v4.app.FragmentManagerImpl$1.run (FragmentManagerImpl.java:710) android.os.Handler.handleCallback (Handler.java:815) android.os.Handler.dispatchMessage (Handler.java:104) android.os.Looper.loop (Looper.java:207) android.app.ActivityThread.main (ActivityThread.java:5728) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:888) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:749)

In my stack trace is not reported the name of the .so file. But the 9th line of NativeConnectivityListener.java load the "mapbox-gl" library (that linux should translate in "libmapbox-gl.so" file. Same to your stack trace.

Please, ask me if you need some more info.

jealalbar commented 6 years ago

Jl