Caused by: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.esri.arcgisruntime.mapping.view.MapView
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.esri.arcgisruntime.mapping.view.MapView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:656)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:798)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:738)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:832)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
I am downloaded SDK100.0.0 for android ,and add to lib . I created a xml , but MapView throw InflateException. So i try to install the SDK that According to the official recommendation,but sync failed again,"Failed to resolve: com.esri.arcgisruntime:arcgis-android:100.0.0".
I will be cry. Who can talk me it is why? thanks.
Solved! Go to Solution.
So in your previous post it looks like you have Runtime v 100 installed as well. Which runtime do you intend to target? If you are targeting runtime 10.2.x, the mapview XML format is com.esri.android.map.MapView not
com.esri.arcgisruntime.mapping.view.MapView
as that is a runtime v 100 format.
Are you storing your layout file in R.layout.my_layout? Can you upload the XML of the layout you used so I can test on my end?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.hjy.myapplication.MainActivity"> <com.esri.arcgisruntime.mapping.view.MapView android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent"/> </RelativeLayout>
this is my layout.Thanks for your reply
Nothing jumps out at me as being off here. Would you kindly upload the smallest reproducible sample for further inspection on my end?
For some reason, it does not look like I am able to open any of those zip files. Do you perhaps have another means of showing me? Perhaps over GitHub?
Sorry , I forgot the password for GitHub.It has been bothering me for a long time.Here is all my code:
this is mainActivity.java:
-------------------------------------------------------------------------------------------------------------------------------------
public class MainActivity extends AppCompatActivity { private MapView mapView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mapView=(MapView)findViewById(R.id.mapview); } }
this is module build.gradle:
--------------------------------------------------------------------------------------------------------------------------------------
apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" packagingOptions{ exclude 'META-INF/LGPL2.1' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' } defaultConfig { applicationId "com.example.hjy.testmapview" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } // sourceSets { // main { // jniLibs.srcDirs = ['libs'] // } // } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:design:25.3.1' compile 'com.android.support:support-vector-drawable:25.3.1' compile 'com.esri.arcgis.android:arcgis-android:10.2.8' // compile files('libs/arcgis-android-api.jar') // compile files('libs/gson-2.3.1.jar') }
this is project build.gradle:
--------------------------------------------------------------------------------------------------------------------------------------------------------------
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() maven { url 'http://dl.bintray.com/esri/arcgis' } } } task clean(type: Delete) { delete rootProject.buildDir }
this is main.xml:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.hjy.testmapview.MainActivity"> <com.esri.arcgisruntime.mapping.view.MapView android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent"/> </RelativeLayout>
So in your previous post it looks like you have Runtime v 100 installed as well. Which runtime do you intend to target? If you are targeting runtime 10.2.x, the mapview XML format is com.esri.android.map.MapView not
com.esri.arcgisruntime.mapping.view.MapView
as that is a runtime v 100 format.
Oh , my god ! I sorry ,I just think it is same of the Mapview. I think i should take a break。haha~
Yeah, it can kind of be tricky when moving from the old runtime to the new runtime. Glad that we were able to get this cleared up. Would you kindly mark the correct answer?
Thanks,
Alexander