Android的致命错误

时间:2012-10-23 08:14:15

标签: java android

10-23 08:07:24.488: E/AndroidRuntime(399): FATAL EXCEPTION: main
10-23 08:07:24.488: E/AndroidRuntime(399): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.tryagain/com.example.tryagain.MainActivity}: java.lang.ClassNotFoundException: com.example.tryagain.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.tryagain-2.apk]
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.os.Looper.loop(Looper.java:123)
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.app.ActivityThread.main(ActivityThread.java:3683)
10-23 08:07:24.488: E/AndroidRuntime(399):  at java.lang.reflect.Method.invokeNative(Native Method)
10-23 08:07:24.488: E/AndroidRuntime(399):  at java.lang.reflect.Method.invoke(Method.java:507)
10-23 08:07:24.488: E/AndroidRuntime(399):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-23 08:07:24.488: E/AndroidRuntime(399):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-23 08:07:24.488: E/AndroidRuntime(399):  at dalvik.system.NativeStart.main(Native Method)
10-23 08:07:24.488: E/AndroidRuntime(399): Caused by: java.lang.ClassNotFoundException: com.example.tryagain.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.tryagain-2.apk]
10-23 08:07:24.488: E/AndroidRuntime(399):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
10-23 08:07:24.488: E/AndroidRuntime(399):  at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
10-23 08:07:24.488: E/AndroidRuntime(399):  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
10-23 08:07:24.488: E/AndroidRuntime(399):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
10-23 08:07:24.488: E/AndroidRuntime(399):  ... 11 more

问题是什么? 谢谢!

1 个答案:

答案 0 :(得分:1)

1)检查AndroidManifest.xml中给出的包名称

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.tryagain">

2)您是否在AndroidManifest.xml中添加了活动信​​息?

<application android:icon="@drawable/icon" android:label="@string/app_name">
  <activity android:name=".MainActivity" android:label="@string/app_name"></activity>
   .......
</application>