Java – NoClassDefFoundError when adding SocialAuth in Eclipse

NoClassDefFoundError when adding SocialAuth in Eclipse… here is a solution to the problem.

NoClassDefFoundError when adding SocialAuth in Eclipse

I tried adding an external library to my Android project, but it didn’t work. My app crashes with an exception at runtime:

09-06 07:44:41.921: E/AndroidRuntime(601): java.lang.NoClassDefFoundError: org.brickred.socialauth.android.SocialAuthAdapter

Found many different amazing solutions but nothing helped :

  1. Create the directory “libs” and add a JAR to it.
  2. JAR has also been added to Project Properties → Java Build Path → Library
  3. In Project properties → Java build path → Order and Export, move the JAR to the top and select it
  4. Try cleaning up the project or even creating a new one.
  5. The latest version of Eclipse is installed.

I see that the size of the APK changes when adding a library.

Any ideas?

Software used:

  • Eclipse: Version: Juno Release Build id: 20120614-1722
  • ADT:20.0.3.v201208082019-427395

Solution

I’m having the same problem, none of the existing answers here solve the problem.

Then I checked the SocialAuth example (which works) and noticed that the jar name is different from mine – socialauth-android.jar instead of socialauth-android-1.0.jar strong >

I used socialauth-android.jar jar and the runtime error disappeared.

Related Problems and Solutions