I\'ve tried both the example in Oracle\'s Java Tutorials. They both compile fine, but at run-time, both come up with this error:
Exception in thread \"main\"
I have faced with the problem today. I have an Android project and after enabling multidex
the project wouldn't start anymore.
The reason was that I had forgotten to call the specific multidex method that should be added to the Application class
and invoked before everything else.
MultiDex.install(this);
Follow this tutorial to enable multidex correctly. https://developer.android.com/studio/build/multidex.html
You should add these lines to your Application class
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
java.lang.NoClassDefFoundError
indicates, that something was found at compiletime but not at runtime. maybe you just have to add it to the classpath.
I got this error after a Git branch change. For the specific case of Eclipse,there were missed lines on .settings directory for org.eclipse.wst.common.component file. As you can see below
Restoring the project dependencies with Maven Install would help.