14

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...

JJD
  • 50,076
  • 60
  • 203
  • 339
Charlie-Blake
  • 10,832
  • 13
  • 55
  • 90
  • Check if the classes exist, also check if builders are present and in the right order. – Snicolas May 17 '13 at 06:45
  • The classes DO exist. Builders? What do you mean? – Charlie-Blake May 17 '13 at 06:49
  • No sorry, builders where a wrong track, I am sure the annotation processor is on. – Snicolas May 17 '13 at 06:57
  • @santirivera92 what is this "com.cidaut.blueparking.SplashScreen_"? I mean I think you have added library in your project.. am I right? – Maulik May 17 '13 at 07:00
  • @santirivera92 and also make sure you have check Android Private Libraries checked.. your all jar files should be in your Android Private Libs. – Maulik May 17 '13 at 07:01
  • Included all the Android libraries (4.2.2, Dependencies and Private libs). Now SplashScreen_ shows up but then I get a NoClassDefFoundError when I call `MapScreen_.intent(this).start();` – Charlie-Blake May 17 '13 at 07:06
  • Added the Error Log which shows the class generation to the question. – Charlie-Blake May 17 '13 at 07:09
  • have you checked true of Android Private Libs in the Java Build path? If yes then please update it in your question and please try to restarts once your eclipse. – Maulik May 17 '13 at 07:14
  • It is working now ^^ I edited the question with the complete solution. Thank you very much guys! – Charlie-Blake May 17 '13 at 07:17
  • after 3 hours i found that with the default `target/generated-sources/annotation` Generadted source directory DONT WORKS! change name to other thing like `target/generated-sources/aa` and works trust me – rkmax Feb 02 '14 at 07:15

5 Answers5

16

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

Kuffs
  • 35,581
  • 10
  • 79
  • 92
  • Ok, you were partially right. The problem was not within the Order and Export tab of my project, but within the Order and Export tab of my libraries. Now I'm exporting everything in every project and it works again. Thank you very much! – Charlie-Blake May 17 '13 at 07:13
10

Here is the solution :

  1. In Eclipse, right click on the Project name and choose Properties

  2. Select Order and Export tab, then make sure that the Android Private Libraries is checked

  3. Clean your project, from Project -> Clean

This should work

Dev2rights
  • 3,469
  • 3
  • 25
  • 42
Andry
  • 101
  • 3
4

I had the same issue and for me it was due to the "Allow output folder for source folder" option in the project "java build path". I unchecked it, and checked it again and the problem was gone. For whatever reason the path used was different to the default one. Maybe it is due to m2e android.

manutudescends
  • 121
  • 1
  • 2
  • 7
  • Oh, wow, I spent ages on this. I'm using android-maven-plugin 3.9.0-rc.2 with ADT 22.6.3.v201404151837-1123206. I finally went to **Properties|Java Build Path|Source** and unchecked and rechecked "Allow output folders for source folders" (for both my application project and my library project) and did a clean build. This error went away! Strangely enough, I went back to the projects' properties, and this option is now _unchecked_! But at least my app is running now. – Garret Wilson Jun 01 '14 at 17:11
3

I'd had a similar problem - turned out that there was a JAR mismatch of the support library included in a references project which was causing the problem. Making sure that each project was using the same version of the support library fixed it for me.

Ben Pearson
  • 7,532
  • 4
  • 30
  • 50
  • You are right,, sometimes it happens because of JAR mismatch – Rahul Matte Mar 24 '15 at 11:39
  • Yup, for some reason when working on devices lower than API 21, having duplicate dependencies in a module and a project will cause this error. Too bad the stack trace doesn't provide a clue! – galaxigirl Sep 29 '16 at 07:35
1

Popping in here with an answer in case someone is having this issue in the future. I added ActionBarCompat to my app which was using AndroidAnnotations and was having this same issue. It turns out that all of the libraries which are being used by a particular application need to live within the parent app. So, even though ABC was a library project within Eclipse and the code compiled, I still needed to include ABC as a library within my application.

Jonathan
  • 3,369
  • 4
  • 22
  • 27