Shared publicly  - 
#android developers!

If you have ClassDefNotFoundError after updating to r17, make sure to read the following links:

- shows how to fix the problem with nice pictures of what the project should look like.

(this was linked from the blog post and from the release notes) explains in detail how the new dependency system works.

If you are referencing Java-only projects, also make sure that they are marked as exported in the Build Path config.
If those projects reference Jar libraries, those need to be marked as exported as well.

David Hamilton's profile photoChris Smith's profile photoTim Luther Lewis's profile photoJeremy Edwards's profile photo
thanks for the update. Perhaps for r18, you could push a heads up to the main android-dev g+ or twitter streams in advance?
+Xavier Ducrohet When you say "marked as exported in the Build Path config" is there a better way to do this than editing the .classpath file? I can't see anything in the Project Properties dialog boxes.
So.... Do you want to know about the couple of things we found? ;-)
We read the docs. Nothing big. But, I've got a surprise....
Rainbows, unicorns, and free beer, my friend.
Thanks Xavier. I didn't say but really, what a great job you guys are doing. The ADT + Tools have been an everyday part of my work since they were released.

Offtopic: do you (g) have best practices on blending ant, maven, library projects wrt android work?
Ugh... I spent a day and a half fixing my project after upgrading to r17. :(
Qi Fan
Hi Xavier, may you please post a temporary fix for the unit test NoClassDefFoundError in ant script? ( Our project depends on automated tests to assure quality and rapid release. So if R18 is not going to be released in 48 hours then a temporary fix would be very helpful. Thanks!
I have a Java project that is referenced by an android test project (both in eclipse) and I get this problem. What are my options? I don't want to have to jar up the java project each time to make this work.
+Xavier Ducrohet thanks for the fixed anttasks.jar ! Fixed the breakage in r17 for me with ant test tasks. Might be worth advertising this fix bit more widely so that others don't get stuck on this for as long as I did yesterday...
Thanks for the info, +Xavier Ducrohet. What is the recommended way to attach source and/or documentation to library .jars in r17, now that they are no longer referenced in the .classpath file? Please don't tell me it's gone!
Hi Xavier, I just wanted to add a reminder to strip your lib project's jar of any the lint classes to avoid “already added” dx errors in the projects that include that jar in their libs folder since those classes are included in the projects as well. I couldn't easily find another way to prevent those classes other than this workaround (note: I build the lib with ant, the projects with Eclipse)
@Xavier sorry I meant SuppressLint.class and TargetApi.class
+Xavier Ducrohet I hope you read this. I tried everything, started with the libs thing, the export thing for projects, checked all my libraries but it's still not working. I'm getting that stupid "Conversion to Dalvik format failed with error 1" all the time. Any hints? Can you help?

I don't want to revert back to r16 once again ^^
Mike, what is the source of your "Conversion to Dalvik format failed with error 1" from the stack trace? Does it happen to be "java.lang.IllegalArgumentException: already added: Landroid/annotation/SuppressLint;" ?
I'm afraid i can't name this, i've reverted back to ADT r16 yesterday, so i was able to develop my apps again. Can i still find the stack traces from yesterday?
Hi +Xavier Ducrohet ,
Although I've read your links I'm not able to run correctly a test project that depends from various external jar libraries in a Eclipse Android JUnit Test Runner.
I've tried to put all the jars in libs folders and remove manual dependencis and also tried with exported an non exported but I always get Can't load class make sure it's in your apk in adb when project runs.
Any ideas or a sample with a test project that use external libraries and jars?
it sucks that every time i update the sdk, my project is broken and i have to search for a fix on the internet....
Hi, my android project consists of 2 source folder: one for main class and one for test cases. My test case has reference to classes in the main source folder. WHen i run the project as Android JUnit test, I received ClassNotFoundException error.

Not sure how to apply your solution to my problem here.
r18 solves all my issues. Thanks!
Thanks! I was about to go crazy when I updated a project and suddenly everything broke.
Any suggestions for someone using a third party jar which is exporting stuff from annotations.jar.  I am getting Conversions to Dalvik errors because of this "already added: Landroid/annotation/SuppressLint".  The jar is coming from another source and I have no control over what exports are there.
I'm still confused by this:
  An android project has a 'libs' folder and apparently, that's where your supposed to place your external jar files. 
So what does the standard eclipse way of doing things (properties->Java Build Path->libraries etc.) have to do with this? Do we reference that jar file here as well? That seems confusing and redundant and is certainly leading me to have opaque and time consuming linking errors.
  Why are there so many overlapping systems? This build system seems unforgiving, counter-intuitive and highly fragile.
The standard way of doing classpath in Eclipse works as long as you don't use library projects.

Dependencies on library projects is too complex for simple project referencing in Eclipse and so we had to try to contort Eclipse into doing things a different way. Putting jars in libs is required if it's a library projects so that parent projects can get the transitive dependencies (while resolving some conflicts).

We are well aware of the difficulties due to this and are actively working on a new build system to have  built-in support for android project dependencies. see
This is the first step. IDE integration will come next.
Thanks for the reply. My headaches have been caused by my desire to have one set of sources shared largely between JSE and android - I do most of my development in windows as the turn around is quicker but I want to run on android also, without repeating code.
  The best compromise I've been able to come up with so far is using source linking on the android side but this can lead to some problems when trying to package things up neatly in to libraries - also, all of that broke when I looked at my code again after a break with an updated ADK.  
  Linking sources into one android library jar have solved my headaches - I can now link things together easily, even if it's a little confusing. The next problem I faced was debugging - eclipse didn't want to display the sources until I supplied a file with the line "src='my_source_location'" in it. Perhaps that could iterate through a few likely source location candidates if the .properties file is missing or incorrect (for that 'it just works' smell of a forgiving work environment)
Add a comment...