Evgenii Lepikhin
Evgenii Lepikhin

Reputation: 159

NoClassDefFoundError when adding SocialAuth in Eclipse

I tried to add an external library to my Android project but with no luck. My application crashed 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 magic solutions, but nothing helped:

  1. Created directory "libs" and added JARs there.
  2. Also added JARs in "Project properties → Java build path → Libraries"
  3. In "Project properties → Java build path → Order and Export" moved JARs to top and checked it
  4. Tried to clean project and even create new project.
  5. Installed latest version of Eclipse.

I see the size of APK is changed when I add the library.

Any ideas?

Software used:

Upvotes: 4

Views: 1302

Answers (7)

Si.
Si.

Reputation: 379

I had the same problem and none of the existing answers here solved the problem.

Then I checked the SocialAuth examples (which worked), and noticed that the jar name was different to mine - socialauth-android.jar instead of socialauth-android-1.0.jar

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

Upvotes: 2

forcelain
forcelain

Reputation: 1576

Once you have socialauth-*.jar and socialauth-android.jar in your libs folder try to right click on it and choose Build Path > Add to Build Path. In my case, the problem is gone when I got "Referenced Libraries" in my project.

Upvotes: 0

vineet
vineet

Reputation: 269

You just need to add jars supplied in sdk in your build path. Have you tried other examples inside sdk. If you still face the issue, you can mail to support of socialauth android.

Upvotes: 0

user1290288
user1290288

Reputation:

You just need to define a new activity in AndroidManifest.xml file.

Put the below code inside <application> ----</application> tag of your manifest file.

<uses-library android:name="org.brickred.socialauth.android.SocialAuthAdapter" />

Upvotes: 1

Rajendra
Rajendra

Reputation: 1698

Paste the jar file in the libs folder go to *-> properties-> java build path->libraries-> press Add jars ->*select your application libs folder And select the jar file and press ok and clear your project.

Upvotes: 0

Germann Arlington
Germann Arlington

Reputation: 3353

java.lang.NoClassDefFoundError is a runtime error. It means that it is NOT important where and how you place your jars in your project (missing jars here would result in compile time errors). What is important is to make sure that your required jars are included in the built resulting jar. Try to open your compiled/generated jar file and check if it contains the required jars and that they are in correct place.

Upvotes: 0

Kelvin Trinh
Kelvin Trinh

Reputation: 1248

Sometimes, error caused by updating ADT. Try put this inside your <Application> tags in Manifiest.xml file

<uses-library android:name="org.brickred.socialauth...(your lib name)" />

And see for more if Ref Lib is checked in your prj properties: Manage project libs

Upvotes: 0

Related Questions