-1
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

有什么问题?谢谢!

4

1 回答 1

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>
于 2012-10-23T08:26:35.813 回答