Monday, June 10, 2013

Getting java.lang.NoClassDefFoundError after upgrade to ADT 22

After updating your Android SDK & ADT plugin, some fellow developers may be facing java.lang.NoClassDefFoundError at runtime even dependency libraries already added to the project.  To fix this issue, I found the solution at Google adt-dev group. The solution is as follows:-

It was indeed an issue with 'Order and Export' of the Java Build Path.

When upgrading, the 'Order and Export' of the new 'Android Private Libraries' is not always checked. And the android-support-v4.jar is now in this 'Android Private Libraries' section. 

To fix this, go to 'Order and Export' and check 'Android Private Libraries'. Then refresh/clean/rebuild.

After you done this 'fix' for a library project, you may need to just close and re-open any depending project, because they may not see this 'fix' immediately.