Ad

When Adding MapView To Android Application, Get Cross-loader Exception

- 1 answer

I have a project in Android and I want to add MapView to it. I did the following:

  1. Downloaded the Google APIs revision 3.
  2. Added the maps.jar library to my project
  3. Added the MapView to an activity
  4. Created new Virtual Device with target the Google APIs (not the normal target Android 1.5)
  5. Started the project

When I try to reach the activity with the map view, I get

....................

12-16 20:57:44.620: ERROR/AndroidRuntime(792): Caused by: java.lang.IllegalAccessError: cross-loader access from pre-verified class

12-16 20:57:44.620: ERROR/AndroidRuntime(792): at dalvik.system.DexFile.defineClass(Native Method)

12-16 20:57:44.620: ERROR/AndroidRuntime(792): at dalvik.system.DexFile.loadClass(DexFile.java:193)

............

What am I doing wrong?

Ad

Answer

If using Eclipse, make sure that you don't have multiple references to the maps.jar on your Project Build Path. This includes any direct reference to the maps.jar, or implicit reference through the Google APIs Library (Google APIs [Android 1.5]). In fact, only having the Google APIs Library on your Project Build Path should be sufficient.

http://andmobidev.blogspot.com

Ad
source: stackoverflow.com
Ad