I have problem with app crashing on start while invoking it causes exception:
Affected devices are running Android 6.0 / 6.0.1. But it doesn't occur on all devices. Some of them are:
I have tried running it with and without ProGuard, but still no effect. Any ideas? |
Solved! Go to Solution.
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.neseapl.test-1/base.apk"],nativeLibraryDirectories=[/data/app/com.neseapl.test-1/lib/arm64, /data/app/com.neseapl.test-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libruntimecore_java.so"
Not quite sure how to fix this issue, seems to be not able to find the native libraries.
Yes, I agree that this is most likely what's happening. I can see in the path above that arm64 paths are involved, and also there was a comment above that things work OK, until another dependency is added. Given those two points, it's very possible you're running in to the problem where once Android has loaded a 64-bit native library, it no longer loads 32-bit libraries.
StackOverflow contains this question and answer which might help explain things: How to use 32-bit native libaries on 64-bit Android device - Stack Overflow . This blog post might also be useful: https://corbt.com/posts/2015/09/18/mixing-32-and-64bit-dependencies-in-android.html . The ArcGIS Runtime SDK provides 32-bit armeabi-v7a library, which would normally be loaded when running on 64 bit, as its forwardly compatible, which would explain why you're finding things OK until you add more dependencies.
Hello Artur Rybak,
I am going to test this on my Nexus 5X and let you know the results. I am assuming that you are using 10.2.8?
Thanks,
Alexander
I have gone ahead and tested this on Android 6.0.1 on an LG Nexus 5x and was not able to reproduce the results that you are seeing. Below is the code that I used in my sample.
public class MainActivity extends AppCompatActivity { MapView mapView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LicenseResult licR = ArcGISRuntime.setClientId(getString(R.string.ArcGISClientId)); Log.e("NOHE",licR.toString()); setContentView(R.layout.activity_main); Toast.makeText(getApplicationContext(), "points added to MapView First", Toast.LENGTH_LONG).show(); } }
Hope you don't mind me bumping and replying to this thread as I am facing the same issue.
When I am compiling a project with just arcgis and no other dependencies, it seems to run fine. However when I added more dependencies, this issue starts to pop up. I started a new empty project and am able to replicate the issue.
The Gradle file I tried is as follow, which contain more of the commonly used libraries. It will also be a multi dex app because of this.
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.android.support:design:24.0.0' compile 'com.android.support:recyclerview-v7:24.0.+' compile 'com.android.support:gridlayout-v7:24.0.+' compile 'com.squareup.okhttp3:okhttp:3.0.1' compile 'com.squareup.retrofit2:retrofit:2.0.2' compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2' compile 'com.squareup.retrofit2:converter-gson:2.0.2' compile 'com.google.android.gms:play-services-gcm:9.2.0' compile 'com.google.android.gms:play-services-location:9.2.0' compile 'com.google.android.gms:play-services-analytics:9.2.0' compile 'com.google.code.gson:gson:2.2.4' compile 'com.karumi:dexter:2.2.2' compile 'com.github.clans:fab:1.6.4' compile 'com.jakewharton:butterknife:7.0.1' compile 'uk.co.chrisjenx:calligraphy:2.1.0' compile 'com.daimajia.swipelayout:library:1.2.0@aar' compile 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.0.4' compile 'com.esri.arcgis.android:arcgis-android:10.2.8-1' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2' compile 'io.realm:android-adapters:1.0.1' compile 'com.github.thorbenprimke:realm-recyclerview:0.9.22' debugCompile 'com.facebook.stetho:stetho-okhttp3:1.3.1' debugCompile 'com.facebook.stetho:stetho:1.3.1' }
The Application file, which the app crashes on,
public class MyApplication extends MultiDexApplication { @Override public void onCreate() { super.onCreate(); ArcGISRuntime.setClientId(getString(R.string.ArcGISClientId)); } }
The full stack trace,
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: java.lang.reflect.InvocationTargetException
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at java.lang.reflect.Method.invoke(Native Method)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.esri.core.internal.util.f.b(SourceFile:67)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.esri.core.internal.util.f.a(SourceFile:21)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.esri.core.internal.util.f$1.initialize(SourceFile:38)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.esri.android.runtime.ArcGISRuntime$License.<clinit>(SourceFile:77)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.esri.android.runtime.ArcGISRuntime.setClientId(SourceFile:51)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.neseapl.test.MyApplication.onCreate(MyApplication.java:14)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6321)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at android.app.ActivityThread.access$1800(ActivityThread.java:222)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1861)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at android.os.Looper.loop(Looper.java:158)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7229)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at java.lang.reflect.Method.invoke(Native Method)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.neseapl.test-1/base.apk"],nativeLibraryDirectories=[/data/app/com.neseapl.test-1/lib/arm64, /data/app/com.neseapl.test-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libruntimecore_java.so"
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at java.lang.Runtime.loadLibrary(Runtime.java:367)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at java.lang.System.loadLibrary(System.java:1076)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.esri.core.internal.RuntimeHelper.a(SourceFile:85)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: at com.esri.core.internal.RuntimeHelper.initialize(SourceFile:47)
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: ... 17 more
08-15 11:18:08.781 8719-8719/com.neseapl.test E/art: No implementation found for boolean com.esri.core.runtime.LicenseImpl.nativeIsClientIdValid(java.lang.String) (tried Java_com_esri_core_runtime_LicenseImpl_nativeIsClientIdValid and Java_com_esri_core_runtime_LicenseImpl_nativeIsClientIdValid__Ljava_lang_String_2)
08-15 11:18:08.781 8719-8719/com.neseapl.test D/AndroidRuntime: Shutting down VM
08-15 11:18:08.781 8719-8719/com.neseapl.test E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.neseapl.test, PID: 8719
java.lang.UnsatisfiedLinkError: No implementation found for boolean com.esri.core.runtime.LicenseImpl.nativeIsClientIdValid(java.lang.String) (tried Java_com_esri_core_runtime_LicenseImpl_nativeIsClientIdValid and Java_com_esri_core_runtime_LicenseImpl_nativeIsClientIdValid__Ljava_lang_String_2)
at com.esri.core.runtime.LicenseImpl.nativeIsClientIdValid(Native Method)
at com.esri.core.runtime.LicenseImpl.b(SourceFile:103)
at com.esri.android.runtime.ArcGISRuntime$License.b(SourceFile:133)
at com.esri.android.runtime.ArcGISRuntime$License.a(SourceFile:72)
at com.esri.android.runtime.ArcGISRuntime.setClientId(SourceFile:51)
at com.neseapl.test.MyApplication.onCreate(MyApplication.java:14)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6321)
at android.app.ActivityThread.access$1800(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1861)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Not quite sure how to fix this issue, seems to be not able to find the native libraries. Any help or advice would be graetly appreciated.
Edit. This is tested on Samsung Galaxy Note5(SM-N920i) 6.0.1
Thanks!
Are you only able to reproduce on this device or are you able to reproduce on an emulator as well?
Thanks
I can reproduce with a Nexus 5x on Android M. Cannot reproduce on an emulator.
I will continue to research this issue.
Hello T S
I found that including the following line is generating the crash on my end:
compile 'io.realm:android-adapters:1.0.1'
This error seems to be propagated from Realm.
Thanks for the tip on the error.
I removed the above dependency, but it appears the main plugin of realm is also causing this issue.
After researching and reading up, it seems to be an issue with Android not being able to load 32-bit and 64-bit native libraries concurrently, which is mentioned in the FAQ of Realm.
To help other users which might face the problem, a similar user had the same problem with other native libraries with Realm which you can read up on SO(android - Using JavaCV and Realm together causes "java.lang.UnsatisfiedLinkError" - Stack Overflow)
Thanks for your help.
I checked the FAQ of Realm very briefly and could not find the section on loading 32 bit and 64 bit native libraries. Could you please specify the heading under which this lies?
08-15 11:18:08.781 8719-8719/com.neseapl.test W/System.err: Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.neseapl.test-1/base.apk"],nativeLibraryDirectories=[/data/app/com.neseapl.test-1/lib/arm64, /data/app/com.neseapl.test-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libruntimecore_java.so"
Not quite sure how to fix this issue, seems to be not able to find the native libraries.
Yes, I agree that this is most likely what's happening. I can see in the path above that arm64 paths are involved, and also there was a comment above that things work OK, until another dependency is added. Given those two points, it's very possible you're running in to the problem where once Android has loaded a 64-bit native library, it no longer loads 32-bit libraries.
StackOverflow contains this question and answer which might help explain things: How to use 32-bit native libaries on 64-bit Android device - Stack Overflow . This blog post might also be useful: https://corbt.com/posts/2015/09/18/mixing-32-and-64bit-dependencies-in-android.html . The ArcGIS Runtime SDK provides 32-bit armeabi-v7a library, which would normally be loaded when running on 64 bit, as its forwardly compatible, which would explain why you're finding things OK until you add more dependencies.