Android Unable to instantiate activity ComponentInfo

Android开发环境,真是脆弱....折腾人。

昨晚敲点书上的代码,今天来公司运行,就各种报错,如下:

10-18 10:03:56.063: W/dalvikvm(14661): Unable to resolve superclass of Lcom/example/geoquizfrist/QuizActivity; (761)
10-18 10:03:56.063: W/dalvikvm(14661): Link of class ‘Lcom/example/geoquizfrist/QuizActivity;‘ failed
10-18 10:03:56.073: D/AndroidRuntime(14661): Shutting down VM
10-18 10:03:56.073: W/dalvikvm(14661): threadid=1: thread exiting with uncaught exception (group=0x40ad0228)
10-18 10:03:56.073: E/AndroidRuntime(14661): FATAL EXCEPTION: main
10-18 10:03:56.073: E/AndroidRuntime(14661): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.geoquizfrist/com.example.geoquizfrist.QuizActivity}: java.lang.ClassNotFoundException: com.example.geoquizfrist.QuizActivity
10-18 10:03:56.073: E/AndroidRuntime(14661):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
10-18 10:03:56.073: E/AndroidRuntime(14661):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2229)
10-18 10:03:56.073: E/AndroidRuntime(14661):     at android.app.ActivityThread.access$600(ActivityThread.java:139)
10-18 10:03:56.073: E/AndroidRuntime(14661):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261)
10-18 10:03:56.073: E/AndroidRuntime(14661):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-18 10:03:56.073: E/AndroidRuntime(14661):     at android.os.Looper.loop(Looper.java:154)

QuizActivity这个类明明有,怎么都不行....

后来发现在,是build path的问题。如下图:

必须按上面的这样,要把Android Private Libraries勾上才可以。而且Android Private Libraries下面必须要有appcompat_v7下的libs,如果没有,CLEAN代码。

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。