Bart Bergmans
Bart Bergmans

Reputation: 4121

Error in integrating Parse and Facebook into Android app

I am trying to integrate Parse and Facebook into my app. When I want to make the Facebook login I get this error:

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

The code I use to initialize my Parse and ParseFacebookUtils:

public class App extends Application {
    public static Bitmap profilePicture;

    private static String PARSE_APPLICATION_ID;
    private static String PARSE_CLIENT_KEY;

    @Override
    public void onCreate() {
        super.onCreate();

        PARSE_APPLICATION_ID = getResources().getString(R.string.PARSE_APPLICATION_ID);
        PARSE_CLIENT_KEY = getResources().getString(R.string.PARSE_CLIENT_KEY);

        Parse.enableLocalDatastore(this);
        Parse.initialize(this, PARSE_APPLICATION_ID, PARSE_CLIENT_KEY);

        ParseFacebookUtils.initialize();

    }
}

I included Parse-1.9.0.jar and ParseFacebookUtilsV3-1.9.0.jar in my app. If someone could help me that would be great!

Upvotes: 1

Views: 631

Answers (2)

Pavan Bhushan Maganti
Pavan Bhushan Maganti

Reputation: 131

Bart, You can use Facebook v4 also. For that use ParseFacebookUtils4 instead ParseFacebookUtils3.

Please see my answer here for clear example.

Upvotes: 0

Bart Bergmans
Bart Bergmans

Reputation: 4121

The problem was that the Facebook SDK wasn't loaded. I fixed it by using

compile 'com.facebook.android:facebook-android-sdk:3.23.1'

instead of

compile 'com.facebook.android:facebook-android-sdk:4.0.0'

I think (since Parse is using FacebookUtilsV3) Parse requires Facebook SDK V3 instead of V4.

Upvotes: 1

Related Questions