我正在尝试使Android 'Google Maps Android API v2'的示例代码正常工作。我得到的项目没有错误。但是,当我尝试在我的 Galaxy Nexus 上运行该应用程序(通过 USB 连接到我的笔记本电脑)时,该应用程序立即崩溃。
- 我在 AndroidManifest.xml 中填写了我自己的 Maps API Key
- 我针对 Android 4.1.2 构建
这是日志记录:
Unable to resolve superclass of Lcom/example/mapdemo/BasicMapActivity; (66)
Link of class 'Lcom/example/mapdemo/BasicMapActivity;' failed
Could not find class 'com.example.mapdemo.BasicMapActivity', referenced from method com.example.mapdemo.MainActivity.<clinit>
VFY: unable to resolve const-class 108 (Lcom/example/mapdemo/BasicMapActivity;) in Lcom/example/mapdemo/MainActivity;
VFY: replacing opcode 0x1c at 0x000d
Exception Ljava/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.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
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(Native Method)
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(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.example.mapdemo.BasicMapActivity
at com.example.mapdemo.MainActivity.<clinit>(MainActivity.java:97)
... 15 more
有没有人提示如何解决这个问题或我可能做错了什么?