AnsweredAssumed Answered

Error inflating class com.esri.android.map.MapView

Question asked by umarani on Apr 21, 2014
Latest reply on May 6, 2014 by umarani
Hi,

   I'm using android studio for my application development. I tried adding MapView in my XML file and initialize it in my fragment class but I'm getting following exception.

My project structure:
[ATTACH=CONFIG]33227[/ATTACH]

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


My XML file:
<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>  </FrameLayout>


My Frgament class:

@Override     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()");         meterGroupMapFragmentView = inflater.inflate(R.layout.map_arcgis, container, false);         mapView = (MapView)meterGroupMapFragmentView.findViewById(R.id.my_custom_map);         mapView.addLayer(new ArcGISTiledMapServiceLayer("" +                 "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));           return meterGroupMapFragmentView;     }

Outcomes