现在的位置: 首页 > 移动开发 > 正文

Binary XML file line #6: Error inflating class com.esri.android.map.MapView

2019年05月07日 移动开发 ⁄ 共 6305字 ⁄ 字号 评论关闭

今天上午搞了一上午这个错误终于解决了!先贴出异常来吧:

10-18 10:47:35.210: ERROR/AndroidRuntime(15412): FATAL EXCEPTION: main
10-18 10:47:35.210: ERROR/AndroidRuntime(15412): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.esri.arcgis.android.samples.helloworld/com.esri.arcgis.android.samples.helloworld.HelloWorld}: android.view.InflateException: Binary XML file line #6: Error inflating class com.esri.android.map.MapView
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1969)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1994)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.ActivityThread.access$600(ActivityThread.java:126)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1150)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.os.Looper.loop(Looper.java:137)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.ActivityThread.main(ActivityThread.java:4439)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at java.lang.reflect.Method.invokeNative(Native Method)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at java.lang.reflect.Method.invoke(Method.java:511)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at dalvik.system.NativeStart.main(Native Method)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class com.esri.android.map.MapView
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.view.LayoutInflater.rInflate(sLayoutInflater.java:739)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:253)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.Activity.setContentView(Activity.java:1841)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.esri.arcgis.android.samples.helloworld.HelloWorld.onCreate(HelloWorld.java:40)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.Activity.performCreate(Activity.java:4471)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1933)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     ... 11 more
10-18 10:47:35.210: ERROR/AndroidRuntime(15412): Caused by: java.lang.reflect.InvocationTargetException
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at java.lang.reflect.Constructor.constructNative(Native Method)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     ... 22 more
10-18 10:47:35.210: ERROR/AndroidRuntime(15412): Caused by: java.lang.ExceptionInInitializerError
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.esri.android.map.MapView.a(Unknown Source)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.esri.android.map.MapView.<init>(Unknown Source)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     ... 25 more
10-18 10:47:35.210: ERROR/AndroidRuntime(15412): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load runtimecore_java: findLibrary returned null
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at java.lang.Runtime.loadLibrary(Runtime.java:365)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at java.lang.System.loadLibrary(System.java:535)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.esri.core.internal.util.e$1.initialize(Unknown Source)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.esri.android.io.a.a(Unknown Source)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     at com.esri.android.map.MapSurface.<clinit>(Unknown Source)
10-18 10:47:35.210: ERROR/AndroidRuntime(15412):     ... 27 more
10-18 10:47:35.210: WARN/ActivityManager(315):   Force finishing activity com.esri.arcgis.android.samples.helloworld/.HelloWorld
10-18 10:47:35.340: INFO/ActivityManager(315): Start proc com.android.quicksearchbox for broadcast com.android.quicksearchbox/.CorporaUpdateReceiver: pid=15431 uid=10038 gids={3003}
10-18 10:47:35.340: INFO/ActivityManager(315): No longer want com.miui.weather2 (pid 15099): hidden #16

出现这个错误主要是底层没有对mapview进行定义,异常说我com.esri.android.map.MapView 没有定义

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <com.esri.android.map.MapView
        android:id="@+id/map" 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        initExtent="-19332033.11, -3516.27, -1720941.80, 11737211.28"/>
</LinearLayout>

所以这样就简单了,说明我们还有需要的东西需要导入进行定义底层的mapview,也就是.so文件楼.

所以要将ArcGISAndroidSDK_v10.1.1-u1/plugins/com.esri.arcgis.android.samples_10.1.1.201306271100.jar文件解压,解压出来的有jar包,还有sample!

我是用的里面的helloword里面的demo,但是里面只有jar包没有.so文件,

.so文件添加:

ArcGISAndroidSDK_v10.1.1-u1\plugins这个路径下利用rar解压com.esri.arcgis.android.core_10.1.1.201306271100.jar

解压之后就会得到lib,libs两个文件,jar包我们刚才已经得到,我们现在需要的是libs里面的armeabi,armeabi-v7a里面的两个文件,

把这两个文件夹都拷贝到我们的工程目录下,直接放到那里面,编译部署即可!

http://download.csdn.net/detail/xiaogezq0/6419553  (helloword demo)

http://download.csdn.net/detail/xiaogezq0/6419611 (两个libruntimecore_java.so文件)

http://download.csdn.net/detail/xiaogezq0/6419611  (arcgis  jar包)

http://download.csdn.net/detail/xiaogezq0/6419627  ( arcgis for  android api)

抱歉!评论已关闭.