我正在尝试将Parse和Facebook整合到我的应用中。当我想要登录Facebook时,我收到了这个错误:
java.lang.NoClassDefFoundError: com.facebook.android.Facebook
我用来初始化Parse和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();
}
}
我在我的应用程序中包含了Parse-1.9.0.jar和ParseFacebookUtilsV3-1.9.0.jar。如果有人可以帮助我那会很棒!
答案 0 :(得分:1)
问题在于未加载Facebook SDK。我用
修复了它compile 'com.facebook.android:facebook-android-sdk:3.23.1'
而不是
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
我认为(因为Parse正在使用FacebookUtils V3 )Parse需要Facebook SDK V3而不是V4。
答案 1 :(得分:0)
请参阅我的回答here以获取明确的示例。