The developers over at Google like to change things up with each ADT version, it seems. For those unaware, the ADT (Android Developer Tools) is simply the plugin that goes along with Eclipse. It does all the heavy lifting of compilation (with the Android SDK) for Android projects. Although things are getting more stable with each new version, there are always a few gotchas in each version. The latest version is no different.
In the latest ADT version, you may have seen some unusual runtime crashes after compilation. These crashes come with the error that looks something like “method or object XXX wasn’t found”. When I first saw this crash, I thought something like that would have been caught during compile time. It is really strange to see this crash during the running of the application.
After a bit of poking around on Google’s site, and checking out Stack Exchange like usual, I found a few interesting pages that point to the problem. I eventually found my way to Foxykeep’s article on the latest Android ADT plugin.
The gotcha in this ADT version has to do with how libraries are linked into the APK. Before this version, I would link standard Jar files to a project by going to Properties->Build Paths and then I would add the external Jar there. In ADT 17, this method doesn’t quite work, although you won’t see any compile time errors from Eclipse about it!
Now, instead of the above method, you actually need to add your external libraries to a new source file in your project called “libs”. Any Jar files located in this file will be recognized by the ADT and will be handled appropriately.
Hats off to Foxykeep for finding the right solution. This one is a tough solution to track down.