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

8060
5
06-26-2013 01:38 AM
KevinGebhardt
New Contributor III
Hello,
I have a problem with my application when I instantiate my activity.
I get an exception at setContentView(R.layout.main).
The exception here is directly pointing at my com.esri.android.map.MapView.
My Device: Samsung Galaxy Note 10.1, Android 4.1.2 (API 16)
The strange thing is that the same application works on my medion tablet with android 4.0.3 (API 15).
I adjustet the min- and maxSDK in the AndroidManifest.xml.

The code in my main.xml:
<com.esri.android.map.MapView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </com.esri.android.map.MapView>
The code in my activity:
super.onCreate(savedInstanceState);
setContentView(R.layout.main); // Error occurs here
Perhaps anyone has an idea.
0 Kudos
5 Replies
AndyGup
Esri Regular Contributor
Kevin,

Can you post your logcat dump that shows the error?

Have you tried these steps?

Android Tools > Fix Project Properties > Clean
ArcGIS Tools > Fix Project Properties > Clean

-Andy
0 Kudos
PradeepaSoundar
New Contributor
I'm also getting same error after cleaning and Fix project  properties i'm getting same error....
Here is my stack trace

07-15 16:44:36.639: E/AndroidRuntime(1600): FATAL EXCEPTION: main
07-15 16:44:36.639: E/AndroidRuntime(1600): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hello/com.hello.HellowordActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class com.esri.android.map.MapView
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.os.Looper.loop(Looper.java:137)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.ActivityThread.main(ActivityThread.java:4424)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at java.lang.reflect.Method.invokeNative(Native Method)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at java.lang.reflect.Method.invoke(Method.java:511)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at dalvik.system.NativeStart.main(Native Method)
07-15 16:44:36.639: E/AndroidRuntime(1600): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.esri.android.map.MapView
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.view.LayoutInflater.createView(LayoutInflater.java:606)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.Activity.setContentView(Activity.java:1835)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.hello.HellowordActivity.onCreate(HellowordActivity.java:18)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.Activity.performCreate(Activity.java:4465)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
07-15 16:44:36.639: E/AndroidRuntime(1600):  ... 11 more
07-15 16:44:36.639: E/AndroidRuntime(1600): Caused by: java.lang.reflect.InvocationTargetException
07-15 16:44:36.639: E/AndroidRuntime(1600):  at java.lang.reflect.Constructor.constructNative(Native Method)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at android.view.LayoutInflater.createView(LayoutInflater.java:586)
07-15 16:44:36.639: E/AndroidRuntime(1600):  ... 22 more
07-15 16:44:36.639: E/AndroidRuntime(1600): Caused by: java.lang.ExceptionInInitializerError
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.esri.android.map.MapView.a(Unknown Source)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.esri.android.map.MapView.<init>(Unknown Source)
07-15 16:44:36.639: E/AndroidRuntime(1600):  ... 25 more
07-15 16:44:36.639: E/AndroidRuntime(1600): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load runtimecore_java: findLibrary returned null
07-15 16:44:36.639: E/AndroidRuntime(1600):  at java.lang.Runtime.loadLibrary(Runtime.java:365)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at java.lang.System.loadLibrary(System.java:535)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.esri.core.internal.util.e$1.initialize(Unknown Source)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.esri.android.io.a.a(Unknown Source)
07-15 16:44:36.639: E/AndroidRuntime(1600):  at com.esri.android.map.MapSurface.<clinit>(Unknown Source)
07-15 16:44:36.639: E/AndroidRuntime(1600):  ... 27 more
0 Kudos
by Anonymous User
Not applicable
Would you post your manifest file here?  I m wondering id you have not declared your activity or if something has gotten messed up in the manifest.

Regards,
Doug C
0 Kudos
by Anonymous User
Not applicable
Hi Kevin,

Also what files are listed in your 'lib' directory with in your eclipse project.  Do you see libGLMapCore.so listed there or do you see libruntimecore_java.so?

Please let me know.  I have a hunch that you see libGLMapCore.so, which should be libruntimecore_java.so.

Regards,
Doug
0 Kudos
DanO_Neill
Occasional Contributor III
There is an issue with your projects libraries as the InflateException implies missing dependent libraries. 

The Fix Project Properties workflow which Andy suggested should work.  That feature checks native libs as well as classpath container to ensure the ArcGIS Android version is up to date with installed libraries.  Some users have reported issues with this process and we have made some fixes to the plugin that address this in the next release.  If you continue to have issues you can ensure all your libraries are up to date and set properly by following this manual process:


  • Create a new project with the SDK ArcGIS Project for Android wizard

  • Copy the native libraries from the new project to your existing project. E.g. $/<ProjectRoot>/libs/armeabi(-v7a)/libruntimecore_java.so.  Keep in mind this file name changed at v10.1.1. 

  • Right click your project and select Properties

  • Select Java Build Path > Order and Export tab

  • Confirm that the ArcGIS for Android 10.1.1 classpath container is exported


Now if you are using the Emulator you have to ensure that you set it up to work with OpenGL, ARM cpu, and are using Android 4.0.3 (API 15) and above.
0 Kudos