按照google map developer 每一步都执行后运行出现以下错误 在网上搜到的解决办法,我只用了其中一个可以解决


Unable to resolve superclass of Lcom/example/mapdemo/BasicMapActivity;(66)Link of class'Lcom/example/mapdemo/BasicMapActivity;' failed Couldnot find class'com.example.mapdemo.BasicMapActivity', referenced from method com.example.mapdemo.MainActivity.<clinit> VFY: unable to resolve const-class108(Lcom/example/mapdemo/BasicMapActivity;)inLcom/example/mapdemo/MainActivity; VFY: replacing opcode 0x1c at 0x000dExceptionLjava/lang/NoClassDefFoundError; thrown while initializing Lcom/example/mapdemo/MainActivity;Class init failed in newInstance call (Lcom/example/mapdemo/MainActivity;)Shutting down VM threadid=1: thread exiting with uncaught exception (group=0x41ac9930) FATAL EXCEPTION: main java.lang.ExceptionInInitializerErrorat java.lang.Class.newInstanceImpl(NativeMethod)at java.lang.Class.newInstance(Class.java:1319)at android.app.Instrumentation.newActivity(Instrumentation.java:1054)at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)at android.app.ActivityThread.access$600(ActivityThread.java:141)at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)at android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:137)at android.app.ActivityThread.main(ActivityThread.java:5039)at java.lang.reflect.Method.invokeNative(NativeMethod)at java.lang.reflect.Method.invoke(Method.java:511)at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)at dalvik.system.NativeStart.main(NativeMethod)Causedby: java.lang.NoClassDefFoundError: com.example.mapdemo.BasicMapActivityat com.example.mapdemo.MainActivity.<clinit>(MainActivity.java:97)...15 more


方法:

  1. Go to "Properties" of the project.

  2. Select "Java Build Path"

  3. Select "Order and Export" Tab

  4. You should see the selected project's "src" and "gen" paths and dependencies here.

The order how they listed were first "src" and then "gen" path I switch them, so that "gen" folder is build before the "src"

THEN "Check" each one of the items listed

原文地址:http://stackoverflow.com/questions/13733911/google-maps-android-api-v2-sample-code-crashes