java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

今天更新了一下android-sdk,结果出现了一个问题,浪费我一天的时间才解决。。。

05-20 11:08:07.995: E/AndroidRuntime(6129): FATAL EXCEPTION: main

05-20 11:08:07.995: E/AndroidRuntime(6129): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mediaflag.mwapp/com.mediaflag.mwapp.MainActivity}: java.lang.ClassNotFoundException: com.mediaflag.mwapp.MainActivity

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2108)

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.app.ActivityThread.access$600(ActivityThread.java:149)

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.os.Handler.dispatchMessage(Handler.java:99)

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.os.Looper.loop(Looper.java:153)

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.app.ActivityThread.main(ActivityThread.java:5108)

05-20 11:08:07.995: E/AndroidRuntime(6129): at java.lang.reflect.Method.invokeNative(Native Method)

05-20 11:08:07.995: E/AndroidRuntime(6129): at java.lang.reflect.Method.invoke(Method.java:511)

05-20 11:08:07.995: E/AndroidRuntime(6129): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:989)

05-20 11:08:07.995: E/AndroidRuntime(6129): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)

05-20 11:08:07.995: E/AndroidRuntime(6129): at dalvik.system.NativeStart.main(Native Method)

05-20 11:08:07.995: E/AndroidRuntime(6129): Caused by: java.lang.ClassNotFoundException: com.mediaflag.mwapp.MainActivity

05-20 11:08:07.995: E/AndroidRuntime(6129): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)

05-20 11:08:07.995: E/AndroidRuntime(6129): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)

05-20 11:08:07.995: E/AndroidRuntime(6129): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)

05-20 11:08:07.995: E/AndroidRuntime(6129): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2099)

05-20 11:08:07.995: E/AndroidRuntime(6129): ... 11 more

 

根据错误信息来看,是找不到MainActivity这个类了,除了更新sdk没有做过其他处理,网上搜索到的信息来看都是说AndroidManifest.xml文件里不存在MainActivity,排除此种情况,最终在http://bbs.csdn.net/topics/390053522这里找到了答案,Order and export选项中对应的包没引入!

一个莫名其妙的问题,到现在也没想明白为什么更新sdk后,Order and export中引入的包会出现问题,好在问题解决了,Order and export中引入相应的包就OK了!

你可能感兴趣的:(java.lang.RuntimeException: Unable to instantiate activity ComponentInfo)