Java.lang.NoClassDefFoundError: com.facebook.android.Facebook

I keep getting the java.lang.NoClassDefFoundError: com.facebook.android.Facebook error when starting my application.

This happens when calling:

facebook = new Facebook (APP_ID);

Additional error message:

Could not find class 'com.facebook.android.Facebook' referenced by com.example.example1.ShareOnFacebook.onCreate

I am adding the facebook.jar file through the reference libraries in Eclipse.

Has anyone encountered / solved this problem?

+5
source share
5 answers

Project/Properties/Java Build Path/Order and Export jar. "". .classparh: classpathentry exported = "true" kind = "lib" path = "/my-jars/facebook-android-sdk-1.2.1.jar"

(Project/Clean...)

+19

, ADT "libs", "lib". .

jar "assets" . .

, .

+3

, " " ( com_facebook_android.jar) "Package explorer". .
> a > Android > → facebook → . facebook "". " " .

+2

ADT Android SDK? facebook facebook jar .

They changed the way external links were handled in recent ADT updates and dropped tons of my projects. Removing links and re-adding them seems to do the trick .

+1
source

The solution that worked for me: the android-support-v4.jar file inside my project had a different version from the version inside the facebook project. So I copied the facebook support library to my project folder folder, and it worked like a charm.

0
source

All Articles