2015-03-31 75 views
1

我正在嘗試將解析和Facebook整合到我的應用程序中。當我想使Facebook登錄我得到這個錯誤:將解析和Facebook整合到Android應用程序時出錯

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

我用它來初始化我的分析和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(); 

    } 
} 

我包括解析-1.9.0.jar和ParseFacebookUtilsV3- 1.9.0.jar在我的應用程序。如果有人能幫助我,這將是偉大的!

回答

1

問題在於Facebook SDK未加載。我通過使用

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

代替

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

我認爲(因爲解析是使用FacebookUtils V3)固定它解析需要的Facebook SDK V3,而不是V4。

0

Bart,你也可以使用Facebook v4。爲此使用ParseFacebookUtils4而不是ParseFacebookUtils3。

請參閱我的回答here作爲清晰的例子。

相關問題