2011-06-29 230 views
0

我得到这个错误!类未找到..在android中构建项目时出现这个错误?

请检查下面的错误日志

06-29 09:09:59.384: ERROR/AndroidRuntime(545): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{s.s/s.s.MainActivity}: java.lang.ClassNotFoundException: s.s.MainActivity in loader dalvik.system.PathClassLoader[/data/app/s.s-2.apk] 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1544) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.app.ActivityThread.access$1500(ActivityThread.java:117) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.os.Handler.dispatchMessage(Handler.java:99) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.os.Looper.loop(Looper.java:123) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.app.ActivityThread.main(ActivityThread.java:3647) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at java.lang.reflect.Method.invokeNative(Native Method) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at java.lang.reflect.Method.invoke(Method.java:507) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at dalvik.system.NativeStart.main(Native Method) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545): Caused by: java.lang.ClassNotFoundException: s.s.MainActivity in loader dalvik.system.PathClassLoader[/data/app/s.s-2.apk] 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at java.lang.ClassLoader.loadClass(ClassLoader.java:551) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1536) 
06-29 09:09:59.384: ERROR/AndroidRuntime(545):  ... 11 more 
+1

您添加活动到您的Manifest.xml? –

回答

1

嗯,这意味着该类没有找到:-)

你有叫s.s.MainActivity一类?你是否拼写错了(你的清单和源文件之间的拼写不一致?)。你是否意外地用ProGuard将它从你的apk中解脱出来?

1

看看你的Manifest文件...我认为不在那里添加活动会导致这个问题。

应该是这个样子:

 <activity android:name=".MainActivity"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
相关问题