Android - Android Studio中的ArcGIS for MapView

时间:2014-04-21 15:15:12

标签: android android-mapview arcgis

我尝试使用ArcGIS在我的应用程序中显示地图。我收到了以下异常。

04-21 09:47:39.140  12766-12766/com.compo.consumer E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.compo.consumer, PID: 12766
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.compo.consumer/com.compo.consumer.activity.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.esri.android.map.MapView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.esri.android.map.MapView
        at android.view.LayoutInflater.createView(LayoutInflater.java:620)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
        at com.compo.consumer.activity.GroupMapFragmentArcGIS.onCreateView(GroupMapFragmentArcGIS.java:104)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
        at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
        at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
        at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
        at android.app.Activity.performStart(Activity.java:5241)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.constructNative(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at android.view.LayoutInflater.createView(LayoutInflater.java:594)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
        at com.compo.consumer.activity.GroupMapFragmentArcGIS.onCreateView(GroupMapFragmentArcGIS.java:104)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
        at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
        at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
        at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
        at android.app.Activity.performStart(Activity.java:5241)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.UnsatisfiedLinkError: Couldn't load runtimecore_java from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.compo.consumer-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.compo.consumer-1, /vendor/lib, /system/lib]]]: findLibrary returned null
        at java.lang.Runtime.loadLibrary(Runtime.java:358)
        at java.lang.System.loadLibrary(System.java:526)
        at com.esri.core.internal.util.e$1.initialize(Unknown Source)
        at com.esri.android.io.a.a(Unknown Source)
        at com.esri.android.map.MapSurface.<clinit>(Unknown Source)
        at com.esri.android.map.MapView.a(Unknown Source)
        at com.esri.android.map.MapView.<init>(Unknown Source)
        at java.lang.reflect.Constructor.constructNative(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at android.view.LayoutInflater.createView(LayoutInflater.java:594)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
        at com.compo.consumer.activity.GroupMapFragmentArcGIS.onCreateView(GroupMapFragmentArcGIS.java:104)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
        at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
        at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
        at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
        at android.app.Activity.performStart(Activity.java:5241)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)

这是我的XML布局:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- MapView layout and initial extent -->
 <com.esri.android.map.MapView
    android:id="@+id/my_custom_map"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    initExtent = "-1.3296373526814876E7 3930962.41823043 -1.2807176545789773E7 4201243.7502468005">
</com.esri.android.map.MapView>

这就是我在初始化地图的地方:

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater,container,savedInstanceState);
    // Inflate the layout for this fragment
    Log.d("ON CREATEVIEW()","ON CREATEVIEW()");
    groupMapFragmentView = inflater.inflate(R.layout.map_arcgis, container, false);
    mapView = (MapView)groupMapFragmentView.findViewById(R.id.my_custom_map);


    return groupMapFragmentView;
}

我的app模块的build.gradle:

apply plugin: 'android'

android {
compileSdkVersion 19
buildToolsVersion '19.0.1'

defaultConfig {
    minSdkVersion 10
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}

dependencies {
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/arcgis-android-api.jar')
compile files('libs/jackson-core-lgpl-1.9.5.jar')
compile files('libs/jackson-mapper-lgpl-1.9.5.jar')
compile files('libs/jcifs-1.3.17.jar')
}
android {
packagingOptions {
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}
}

1 个答案:

答案 0 :(得分:0)

现在回答已经太晚了,但是因为我面临着同样的问题并且未来的其他人可以面对它而发布它。 对我有用的解决方案是:&#34;我忘了在/ src / main / path中添加jniLibs文件夹并将.so文件放在那里&#34;如https://developers.arcgis.com/android/guide/install-and-set-up.htm

所述

在我的情况下,我正在工作&#34;离线&#34;在Android工作室中,仅下载了SDK而不是通过Gradle下载。