Force Down error in MapView
i want to open a map when i click a button but unfortunately my app forces down...this is my logcat:
01-31 18:11:49.465: VERBOSE/InputDevice(2836): ID[0]=0(0) Up(1=>0)
01-31 18:11:49.606: WARN/dalvikvm(6111): Class resolved by unexpected DEX: Lkostas/menu/olympiakos/GoogleMaps;(0x486356d8):0x22f5d8 ref [Lcom/google/android/maps/MapActivity;] Lcom/google/android/maps/MapActivity;(0x486356d8):0x21dca0
01-31 18:11:49.606: WARN/dalvikvm(6111): (Lkostas/menu/olympiakos/GoogleMaps; had used a different Lcom/google/android/maps/MapActivity; during pre-verification)
01-31 18:11:49.606: WARN/dalvikvm(6111): Unable to resolve superclass of Lkostas/menu/olympiakos/GoogleMaps; (67)
01-31 18:11:49.606: WARN/dalvikvm(6111): Link of class 'Lkostas/menu/olympiakos/GoogleMaps;' failed
01-31 18:11:49.610: DEBUG/AndroidRuntime(6111): Shutting down VM
01-31 18:11:49.610: WARN/dalvikvm(6111): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): FATAL EXCEPTION: main
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): java.lang.NoClassDefFoundError: kostas.menu.olympiakos.GoogleMaps
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at kostas.menu.olympiakos.DialogActivity$1.onItemClick(DialogActivity.java:47)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.widget.ListView.performItemClick(ListView.java:3672)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.os.Handler.handleCallback(Handler.java:587)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.os.Handler.dispatchMessage(Handler.java:92)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.os.Looper.loop(Looper.java:123)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-31 开发者_StackOverflow社区18:11:49.641: ERROR/AndroidRuntime(6111): at java.lang.reflect.Method.invokeNative(Native Method)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at java.lang.reflect.Method.invoke(Method.java:521)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at dalvik.system.NativeStart.main(Native Method)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at dalvik.system.DexFile.defineClass(Native Method)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:209)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): ... 13 more
01-31 18:11:49.660: WARN/ActivityManager(2836): Force finishing activity kostas.menu.olympiakos/.DialogActivity
thats the way i m calling the map activity:
Intent newActivity111 = new Intent(DialogActivity.this, GoogleMaps.class);
startActivity(newActivity111);
Somehow, your device or emulator has a different implementation of com.google.android.maps.MapActivity
than what your compiler used. That should not be possible under normal circumstances. It suggests that you have seriously messed up your build process, such as manually adding the Maps add-on JAR to your build path rather than just setting a Maps-enabled target.
Not too sure whether your problem is related to the libraries available.
Map library is not part of the Standard Android library. Hence you need to declare it in the Manifest file.
Follow the link: http://developer.android.com/resources/tutorials/views/hello-mapview.html
Since the library is not available your Activity "GoogleMaps" which extends MapActivity doesn't get loaded into the system.
All the questions and answers related to getting the Fatal Exception java.lang.NoClassDefFoundError when using a MapActivity did not help me. CommonsWare's response gave me a hint that helped me arrive at my solution.
When I copied my project to a new environment, my setup did not include the Google Maps library. I added the maps.jar file manually into my project and was able to link the application successfully but when I attempted to start the activity that derived from MapActivity I got the fatal exception.
I removed the reference to the maps.jar library. I then noticed I was building against the Android 2.2 SDK. I did not have the Google APIs SDK installed. After downloading and installing the Google APIs SDK, and specifying this SDK as my target, my problem went away.
精彩评论