1

I set ArcGIS Runtime SDK for Android but run show error Binary XML file line #7: Error inflating class com.esri.android.map.MapView Caused by: java.lang.UnsatisfiedLinkError: No implementation found for long com.esri.android.map.MapSurface.nativeMapCreate(java.lang.String, int, int, float, boolean) (tried Java_com_esri_android_map_MapSurface_nativeMapCreate and Java_com_esri_android_map_MapSurface_nativeMapCreate__Ljava_lang_String_2IIFZ)

And my code

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'
    }
}

And my fragment

@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;
}

2 Answers2

2

It looks like you're using code from the 10.2.x release but are importing the 100.1.0 release within your gradle script. The API has changed between those releases.

falldownhill
  • 101
  • 2
  • here my import compile 'com.esri.arcgisruntime:arcgis-android:100.1.0' but not working – Nguyễn Thanh Tuấn Sep 20 '17 at 14:00
  • 1
    Exactly, but the code you have in the snippet belongs to the 10.2.x release. To use that code you need to use compile 'com.esri.arcgis.android:arcgis-android:10.2.9' If you want to use the 100.1.0 release, the API has changed and the code you have there is no longer valid. – falldownhill Sep 20 '17 at 16:30
1

There is one more possibility to get this exception. If you don't add these lines in your app-level build.gradle file under android. As mentioned here

android {
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}
Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138