Skip to content Skip to sidebar Skip to footer

Java.lang.noclassdeffounderror: Com.facebook.android.facebook

I keep getting the error java.lang.NoClassDefFoundError: com.facebook.android.Facebook when running my application. This occurs when calling: facebook = new Facebook(APP_ID); Addti

Solution 1:

Just go to Project / Properties / Java Build Path / Order and Export and click on jar's checkbox. This will set jar as "exported". You can verify this in .classparh file: classpathentry exported="true" kind="lib" path="/my-jars/facebook-android-sdk-1.2.1.jar"

Don't forget to clean your project after that (Project / Clean...)

Solution 2:

I heard that with the latest ADT you need to name your library folder "libs" and not "lib". But that didn't work for me.

So instead I had to resort to moving my jar file into the "assets" folder. That fixed my problem.

Completely retarded if you ask me.

Solution 3:

I keep getting this issue too, the "Library Projects" (which should contain the com_facebook_android.jar) is not reflected in the "Package explorer" at all. But It is easily solved. Right click on project>Properties>Android> Library -> remove the facebook library project added -> apply. Then add the facebook library project again and click apply. This time "Library Projects" will come up in your Package Explorer on the right side.

Solution 4:

Have you recently updated your ADT or Android SDK? Try deleting the reference to the facebook library or facebook jar and re-adding it.

They changed the way they handle external libraries references in the latest ADT updates, and it's thrown off a ton of my projects. Deleting the references and re-adding them seems to do the trick.

Solution 5:

A solution that worked for me: the android-support-v4.jar file inside my project had a different version from the one inside facebook's project. So I copied facebook's support lib to my project libs folder and it worked like a charm.

Post a Comment for "Java.lang.noclassdeffounderror: Com.facebook.android.facebook"