Don't Manually Modify Your Eclipse Build Path... Except Now for R22
With the standardization of both command-line and Eclipse builds
on having third-party JARs in the
libs/ directory of the project,
developers no longer needed to monkey with the build path in Eclipse.
In fact, changing the build path in Eclipse would tend to cause more
problems than it solved.
However, there’s a bug in the R22 version of the ADT Plugin for Eclipse that does require a one-time modification to your build path:
Right-click on the project in Eclipse’s Package Explorer and choose Build Path > Configure Build Path from the context menu
Switch to the “Order and Export” tab
Check the “Android Private Libraries” entry in the list, if it is not already checked
You will need to do this for all projects that have JARs in
though I would recommend that you do it for every one of your projects,
just so that you don’t forget about this months from now, add a JAR,
and wonder why things are broken. Specifically, by “broken”, I mean
you get a bunch of
NoClassDefFoundError messages at runtime.
Also, be sure to apply this fix to any Android library projects you are using (e.g., ActionBarSherlock), otherwise you may get “class hierarchy is inconsistent” errors.
Note that if you are using Maven, this step is not required, apparently. Quoting Xav Ducrohet:
Unless you’re using Maven to build using the m2Eclipse in which case Maven setups those dependencies itself and the container should not be exported.
There is an R22.0.1 in the works that should address this, though whether they will be able to address it for existing projects (as well as new projects) is unclear.
Also, I owe Streets of Boston a beer, as it was his adt-dev post that helped spearhead letting everyone know about this problem and fix.