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

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


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