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

Mukesh Kumar

Hi Guys I am from Delhi working as Web/Mobile Application Developer(Android Developer), also have knowledge of Roboelctric and Mockito ,android test driven development... Blogging has been my passion and I think blogging is one of the powerful medium to share knowledge and ideas....

3 comments:

  1. May you post a sample project that was correctly set up?
    Unfortunately, I am following any manual from the internet, but I can't get it to work. Not even in a "Hello World" example. (I didn't update, I just started with Android Programming but am very familiar with Java)

    Just seems like my ADT installation is broken...

    ReplyDelete
  2. May you post a sample project that was correctly set up?
    Unfortunately, I am following any manual from the internet, but I can't get it to work. Not even in a "Hello World" example. (I didn't update, I just started with Android Programming but am very familiar with Java)

    Just seems like my ADT installation is broken...

    ReplyDelete
  3. Hello Martin,
    If your android environment is correctly setup then
    when you create an new android project, by default "Hello World" sample project for your guidance will created.You just need to run the application on your emulator or on device.

    refer my this link for Android environment setup:http://mukeshyadav4u.blogspot.in/2013/03/setting-working-environment-for-android.html

    ReplyDelete

 

Copyright @ 2013 Android Developers Blog.