Showing posts with label noclassdeffounderror in android. Show all posts
Showing posts with label noclassdeffounderror in android. Show all posts

Thursday 7 June 2012

“NoClassDefFoundError” after updating ADT plugins 16 to ADT 17



 Hey Droid Guys,

 Yesterday, I  trapped in a really weird situation. My application is running
 fine on ADT plugins 16 but  after updating it to ADT  v17, the same 
 application gives me "NoClassDefFoundError".

 This will be quick post. Did you get "NoClassDefFoundError" after updating ADT
 plugins 16 to ADT plugins 17.


The solution  is:
  • If your jar libraries are in a lib folder, rename it to libs.
  • Remove all your jar libraries from the Build Path of your project. Don’t need to add them again to the Build Path.
  • In your libs folder, you should have just the jar libraries that your project is using. You can’t have different versions of a single library. This is because if you’ve noticed, Eclipse creates now a reference in the Build Path called “Android Dependecies” and he puts there all the jar files that are in your libs folder.
  • Follow steps 1, 2 and 3 for each Android Library Project that your project is using.
  • Make a project clean.
 Important: If you are still referencing jar libraries manually instead of putting them under libs/ be aware of      
      the following:         
  • If the project is a Library project, these jar libraries will not be automatically visible to application projects. You should really move these to libs/
  • If the project is an application, this can work but you must make sure to mark the jar files as exported.

no class definition found errorHere's how to mark Java project and jar libraries as exported (the Android Dependencies container does not have to be marked as exported, it is always exported anyway):

  
Hope it helps anybody! :D

 

Copyright @ 2013 Android Developers Blog.