首页 > 代码库 > Android Unable to instantiate activity ComponentInfo
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;‘ failed10-18 10:03:56.073: D/AndroidRuntime(14661): Shutting down VM10-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: main10-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.QuizActivity10-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代码。
Android Unable to instantiate activity ComponentInfo
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。