I am experiencing an error quite often among my users. The app crashes during startup. When the MainActivity is supposed to be loaded the VM apparently cannot find the class
The NoClassDefFoundError description is, from the SO tag:
The Java Error thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found. The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.
Or better:
NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time.
from this page. Check it, there are some ways to solve the error. I hope it helps.
If none of the above works (like it happened to me), and you're using as a library another project in Eclipse.
Do so: Right click project -> Properties -> Android -> Library -> Add
That did it for me! Adding a project as a library (Project Properties)
Solutions:
I have just figured out something with this error.
Just make sure that the library jar file contains the compiled R class under android.support.v7.appcompat package and copy all the res in the v7 appcompat support "project" in your ANDROID_SDK_HOME/extras/android/support/v7/appcompat folder.
I use Netbeans with the Android plugin and this solved my issue.
1)In Manifest file mention your activity name and action for it and also category . 2)In your Activity mention your starting contentview and mention your view id's in the activity.
jars used to be in the lib/ folder, now they're in libs/ If you use lib, you can move your jars from lib to libs, and remove the dependencies from project properties/java build path because Android will now find them automatically.