java.lang.ClassNotFoundException:更新库后没有找到类

时间:2014-06-10 14:29:06

标签: android

更改Google Play服务图书馆后,我的应用程序无法运行。 当我开始它时出现这样的错误,我试图通过谷歌修复它,但仍然无法修复。 任何人都可以在下面的日志中解释我:

06-10 20:45:13.116: E/AndroidRuntime(18582): FATAL EXCEPTION: main
06-10 20:45:13.116: E/AndroidRuntime(18582): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.kidsgame.kidsmath/com.kidsgame.kidsmath.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.kidsgame.kidsmath.MainActivity" on path: /data/app/com.kidsgame.kidsmath-2.apk
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2171)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.app.ActivityThread.access$700(ActivityThread.java:150)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.os.Looper.loop(Looper.java:137)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.app.ActivityThread.main(ActivityThread.java:5283)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at java.lang.reflect.Method.invokeNative(Native Method)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at java.lang.reflect.Method.invoke(Method.java:511)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at dalvik.system.NativeStart.main(Native Method)
06-10 20:45:13.116: E/AndroidRuntime(18582): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.kidsgame.kidsmath.MainActivity" on path: /data/app/com.kidsgame.kidsmath-2.apk
06-10 20:45:13.116: E/AndroidRuntime(18582):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.app.Instrumentation.newActivity(Instrumentation.java:1071)
06-10 20:45:13.116: E/AndroidRuntime(18582):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
06-10 20:45:13.116: E/AndroidRuntime(18582):    ... 11 more

2 个答案:

答案 0 :(得分:0)

尝试转到Project - >属性 - > Java构建路径 - >订单&导出并确保为您的项目和您正在使用的所有其他库项目检查Android私有库。之后清理所有项目,看看会发生什么。取自here

答案 1 :(得分:0)

在这一行:

06-10 20:45:13.116: E/AndroidRuntime(18582): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.kidsgame.kidsmath.MainActivity" on path: /data/app/com.kidsgame.kidsmath-2.apk

看起来你已经移动了mainactivity.java的文件位置,或者没有导入你需要的类。尝试转到您的类文件并按ctrl + shift + o导入您缺少的任何内容,然后清理项目