Arcgis MapView在某些设备上提供错误(我相信64位),同时给MapView充气。
错误以
开头Binary XML file line #13: Binary XML file line #13: Error inflating class com.esri.android.map.MapView
并在最后一行:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.labs.arctest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.labs.arctest-1/lib/arm64, /data/app/com.labs.arctest-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libruntimecore_java.so"
在某些情况下看起来无法找到库。
Arcgis版本:
compile 'com.esri.arcgis.android:arcgis-android:10.2.7'
简单布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.labs.arctest.MainActivity">
<com.esri.android.map.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
mapoptions.MapType="Streets"
>
</com.esri.android.map.MapView>
</RelativeLayout>
完整日志:
07-15 03:35:52.338 27987 27987 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.labs.arctest/com.labs.arctest.MainActivity}: android.view.InflateException: Binary XML file line #13: Binary XML file line #13: Error inflating class com.esri.android.map.MapView
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2452)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2535)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:154)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.os.Looper.loop(Looper.java:152)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5497)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #13: Binary XML file line #13: Error inflating class com.esri.android.map.MapView
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at com.labs.arctest.MainActivity.onCreate(MainActivity.java:27)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6285)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: ... 9 more
07-15 03:35:52.338 27987 27987 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class com.esri.android.map.MapView
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:645)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: ... 17 more
07-15 03:35:52.338 27987 27987 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at java.lang.reflect.Constructor.newInstance(Native Method)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:619)
07-15 03:35:52.338 27987 27987 E AndroidRuntime: ... 22 more
07-15 03:35:52.338 27987 27987 E AndroidRuntime: Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.labs.arctest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.labs.arctest-1/lib/arm64, /data/app/com.labs.arctest-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libruntimecore_java.so"
答案 0 :(得分:1)
您的项目中是否只有64位的依赖项? Android无法加载混合本机库,它只能通过加载32位或64位来工作。而10.2.8运行时只有32位可用。因此,如果它已经在您的应用程序中加载了64位lib,它将无法加载Esri运行时;但是64位设备可以加载32位lib,因为它们可以向前兼容。
解决此问题的一种方法是删除64位库,这样它们就不会包含在APK中,也无法加载到应用程序中。如果您的应用中的64位依赖项直接包含在您的构建中作为.so
文件,那么只需从您的构建中删除64位文件夹(例如\jniLibs\arm64-v8a
)。如果您在Android Studio中使用gradle,并且依赖项在AAR中,我认为您可以尝试ABI splits described in the Android doc排除64位库 - 例如,要专门排除Armv8 64位库,请更新您的gradle脚本包括:
android {
...
splits {
abi {
exclude 'arm64-v8a'
}
}
}
有一些不同的分割选项 - 请参阅上面的文档链接。