0

I have updated my android sdk from r21 to r22. I also updated the adt. Before the updates, my application work perfectly without error and force close. But now, all of my apps are force close when run via avd or real phone. I don't know the problem, but, it seems that the compiler didn't found my MainActivity class. I have already checked it many times, and I'm sure that my MainActivity doesn't have any error and compile properly.

Here's the logcat error:

05-25 01:11:02.931: E/AndroidRuntime(7724): FATAL EXCEPTION: main
05-25 01:11:02.931: E/AndroidRuntime(7724): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{ca.slim.social/ca.slim.social.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "ca.slim.social.MainActivity" on path: /data/app/ca.slim.social-2.apk
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2223)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2357)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.app.ActivityThread.access$600(ActivityThread.java:153)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.os.Looper.loop(Looper.java:137)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.app.ActivityThread.main(ActivityThread.java:5224)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at java.lang.reflect.Method.invokeNative(Native Method)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at java.lang.reflect.Method.invoke(Method.java:511)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:106)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at dalvik.system.NativeStart.main(Native Method)
[tpb]05-25 01:11:02.931: E/AndroidRuntime(7724): Caused by: java.lang.ClassNotFoundException: Didn't find class "ca.slim.social.MainActivity" on path: /data/app/ca.slim.social-2.apk[/tpb]
05-25 01:11:02.931: E/AndroidRuntime(7724):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
05-25 01:11:02.931: E/AndroidRuntime(7724):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2214)
05-25 01:11:02.931: E/AndroidRuntime(7724):     ... 12 more

NB: I'm using actionbarsherlock, slidingmenu, and viewpagerindicator.

Thank You

4

2 回答 2

2

很多人都有这个问题!

尝试以下解决方案:

ADT 更新后的 ClassNotFoundException

尝试转到 Project -> Properties -> Java Build Path -> Order & Export 并确保为您的项目和您正在使用的所有其他库项目检查 Android Private Libraries。之后清理所有项目,看看会发生什么。


Eclipse 给出错误,最近更新后缺少 R.java 文件

更新到 SDK 工具后进行修订。22第一次,你可能需要重新启动Android SDK Manager并安装一个新的项目:Android SDK Build-tools。

于 2013-05-24T18:59:34.100 回答
0

你用的是哪个版本的java?尝试将您的 JDK 更新到 1.7,如果有帮助,请告诉我们。您也可以尝试此链接中的建议来帮助解决您的问题。

于 2013-05-24T18:35:36.490 回答