1

我是 android 新手,正在开发一个使用 google maps API 的应用程序。

运行应用程序时出现错误:

应用程序意外停止

这是我在 logcat 文件中的内容:

07-11 01:38:25.751: E/AndroidRuntime(401): FATAL EXCEPTION: main
07-11 01:38:25.751: E/AndroidRuntime(401): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.training.surveyproject/com.training.surveyproject.SurveyActivity}: java.lang.ClassNotFoundException: com.training.surveyproject.SurveyActivity in loader dalvik.system.PathClassLoader[/data/app/com.training.surveyproject-2.apk]
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.os.Looper.loop(Looper.java:123)
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.app.ActivityThread.main(ActivityThread.java:4627)
07-11 01:38:25.751: E/AndroidRuntime(401):  at java.lang.reflect.Method.invokeNative(Native Method)
07-11 01:38:25.751: E/AndroidRuntime(401):  at java.lang.reflect.Method.invoke(Method.java:521)
07-11 01:38:25.751: E/AndroidRuntime(401):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-11 01:38:25.751: E/AndroidRuntime(401):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-11 01:38:25.751: E/AndroidRuntime(401):  at dalvik.system.NativeStart.main(Native Method)
07-11 01:38:25.751: E/AndroidRuntime(401): Caused by: java.lang.ClassNotFoundException: com.training.surveyproject.SurveyActivity in loader dalvik.system.PathClassLoader[/data/app/com.training.surveyproject-2.apk]
07-11 01:38:25.751: E/AndroidRuntime(401):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-11 01:38:25.751: E/AndroidRuntime(401):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-11 01:38:25.751: E/AndroidRuntime(401):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-11 01:38:25.751: E/AndroidRuntime(401):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-11 01:38:25.751: E/AndroidRuntime(401):  ... 11 more

谢谢你

4

1 回答 1

3

您必须将活动添加SurveyActivity到您的 AndroidManifest.xml 文件中。

您可能还忘记了将 Google 地图库添加到清单中:

<application>
    <uses-library android:name="com.google.android.maps" />
</application>
于 2012-07-11T01:50:10.890 回答