Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting NoClassDefFoundError when using common.lang.StringUtils in android java code?

I am getting this error:-NoClassDefFoundError wherever the code is using StringUtils class or methods .I have correctly added the jar files to the code and is not showing any kind of error in my code(Using Eclipse Indigo).

Is there any kind of point I am missing out. I have used this jar file in other projects but they worked properly.

Please help If any one is getting similar kind of problem?Thanks

like image 970
Navdroid Avatar asked Aug 06 '12 07:08

Navdroid


2 Answers

Yes, this because of your .jar file didn't import properly. Follow below steps -

  1. Place your .jar file in your project's libs folder .

  2. Import it into your project. And, GoTo project -> properties -> Java build path -> order tab.

  3. Check, whether your .jar file checked and placed in order of 1st. This is the main thing.

Hope these steps helps you. Have a look at below image -

enter image description here

like image 188
Praveenkumar Avatar answered Oct 27 '22 07:10

Praveenkumar


Note that the build classpath is different from the runtime classpath. You must add the required JARs to both.

It's one of the things I don't like in Eclipse...

EDIT: To add JARs to the runtime classpath: in Eclipse, double click the plugin.xml file associated with your project. On the Runtime tab there is a Classpath category. From there, you can add JARs to the runtime classpath.

Here is a screenshot to illustrate this:

plugin.xml runtime classpath

like image 20
Radu Murzea Avatar answered Oct 27 '22 09:10

Radu Murzea