when I try to initialize the FacebookSdk it always deprecates the function call and when I build/run my application it exits with the error "Caused by: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.setApplicationId("165020910744675");
FacebookSdk.sdkInitialize(this);
setContentView(R.layout.activity_main);
callbackManager = CallbackManager.Factory.create();
loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.setHeight(100);
loginButton.setTextColor(Color.WHITE);
loginButton.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
loginButton.setCompoundDrawablePadding(0);
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Log.d(TAG,"success!!! go home.");
}
@Override
public void onCancel() {
Log.d(TAG,"cancel!!! don't go home.");
}
@Override
public void onError(FacebookException error) {
}
});
If we remove the FacebookSdk.sdkInitialize() function (like the FB API says), it causes the same error.