【问题标题】:Error Binary XML file line #7: Error inflating class com.esri.android.map.MapView错误二进制 XML 文件第 7 行:膨胀类 com.esri.android.map.MapView 时出错
【发布时间】:2018-02-28 12:57:11
【问题描述】:

我为 Android 设置了 ArcGIS Runtime SDK 但运行显示错误 二进制 XML 文件第 7 行:膨胀类 com.esri.android.map.MapView 时出错 原因:java.lang.UnsatisfiedLinkError: No implementation found for long com.esri.android.map.MapSurface.nativeMapCreate(java.lang.String, int, int, float, boolean)(试过 Java_com_esri_android_map_MapSurface_nativeMapCreate 和 Java_com_esri_android_map_MapSurface_nativeMapCreate__Ljava_lang_String_2IIFZ)

还有我的代码

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'org.slf4j:slf4j-api:1.7.25'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'pl.bclogic:pulsator4droid:1.0.3'
compile 'com.esri.arcgisruntime:arcgis-android:100.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.makeramen:roundedimageview:2.3.0'
testCompile 'junit:junit:4.12'

}
repositories {
    mavenCentral()
}
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'
    }
}

还有我的片段

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_map, container, false);
    mMapView = (MapView) view.findViewById(R.id.map);
    try {
        shapefileTable = new ShapefileFeatureTable("file:///android_asset/yourPath/vietnam.shp");
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    FeatureLayer featureLayer = new FeatureLayer(shapefileTable);

    UniqueValueRenderer uvRenderer = new UniqueValueRenderer();
    uvRenderer.setDefaultSymbol(new SimpleFillSymbol(R.color.colorPrimary, null));
    // set renderer
    featureLayer.setRenderer(uvRenderer);
    mMapView.addLayer(featureLayer);
    return view;
}

【问题讨论】:

  • 请在此处包含您的 XML。

标签: android dictionary arcgis


【解决方案1】:

看起来您正在使用来自 10.2.x 版本的代码,但正在您的 gradle 脚本中导入 100.1.0 版本。 API 在这些版本之间发生了变化。

【讨论】:

  • 这里我的导入编译 'com.esri.arcgisruntime:arcgis-android:100.1.0' 但不工作
  • 没错,但是您在 sn-p 中的代码属于 10.2.x 版本。要使用该代码,您需要使用 compile 'com.esri.arcgis.android:arcgis-android:10.2.9' 如果您想使用 100.1.0 版本,API 已更改,您拥有的代码不再存在有效。
【解决方案2】:

还有另一种可能获得此异常。如果您不将这些行添加到 android 下的应用级 build.gradle 文件中。如前所述here

android {
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

【讨论】:

    猜你喜欢
    • 2016-01-12
    • 1970-01-01
    • 2019-06-09
    • 1970-01-01
    • 1970-01-01
    • 2016-11-02
    • 2014-08-13
    • 2018-03-04
    相关资源
    最近更新 更多