Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
175 views
in Technique[技术] by (71.8m points)

android - ClassNotFoundException on AndroidAnnotations generated classes since update to ADT 22

This project worked wonders before updating to ADT22. I already lost a day because of not knowing I had to download build tools, and I'm afraid I'm going to loose another one because of this.

When I try to build the same code that was working two days ago, I get this exception:

com.cidaut.blueparking fatal error : Unable to instantiate activity 
    ComponentInfo{com.cidaut.blueparking/com.cidaut.blueparking.SplashScreen_}: 
    java.lang.ClassNotFoundException: 
    Didn't find class "com.cidaut.blueparking.SplashScreen_" on path: 
    /data/app/com.cidaut.blueparking-1.apk
java.lang.RuntimeException: Unable to instantiate activity 
    ComponentInfo{com.cidaut.blueparking/com.cidaut.blueparking.SplashScreen_}: 
    java.lang.ClassNotFoundException: 
    Didn't find class "com.cidaut.blueparking.SplashScreen_" on path: 
    /data/app/com.cidaut.blueparking-1.apk

  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  at android.app.ActivityThread.access$600(ActivityThread.java:141)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:5041)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.ClassNotFoundException: 
    Didn't find class "com.cidaut.blueparking.SplashScreen_" on path: 
    /data/app/com.cidaut.blueparking-1.apk
  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
  at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
  ... 11 more

I actually find it weird that it is trying to find the class on the APK file, but whatever. Is there any solution to this?

By the way, my classpath includes the source folder where AndroidAnnotations generates the code, so that's not the issue.

Here's my Order and Export window

Eclipse / Order and Export

AndroidAnnotations class generation error log

AndroidAnnotations class generation error log

EDIT: Now it is working

The procedure I followed was this:

  1. Clean and rebuild everything
  2. Check everything on the Order and Export tab of every project (both the main project and the libraries)
  3. Clean and rebuild everything again

It works now. I can't believe I have lost almost 12 hours because of this...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Go to the "Order And Export" tab of "Configure Build Path" and click the check mark next to all of your required libraries


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...