I get the following error when trying to login by Facebook when using the latest SDK version which is 4.30:
The SDK has not been initialized, make sure to call
FacebookSdk.sdkInitialize()
Then the application crashes.
Although, in the official documentation it's supposed to be already auto initialized.
Note that FacebookSdk.sdkInitialize()
is deprecated now so it should not be called!
Error Log when not calling FacebookSdk.sdkInitialize()
:
The SDK has not been initialized, make sure to call
FacebookSdk.sdkInitialize() first. at
com.facebook.internal.Validate.sdkInitialized(Validate.java:143) at
com.facebook.login.LoginManager.<init>(LoginManager.java:79) at
com.facebook.login.LoginManager.getInstance(LoginManager.java:92)
at
com.linkdev.tepdeal.login.LoginPresenter.loginWithFacebook(LoginPresenter.java:88)
at
com.linkdev.tepdeal.login.FragmentLogin.onClick(FragmentLogin.java:105)
at android.view.View.performClick(View.java:5637) at
android.view.View$PerformClick.run(View.java:22433) at
android.os.Handler.handleCallback(Handler.java:751) at
android.os.Handler.dispatchMessage(Handler.java:95) at
android.os.Looper.loop(Looper.java:154) at
android.app.ActivityThread.main(ActivityThread.java:6186) at
java.lang.reflect.Method.invoke(Native Method) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
When forcing to call the deprecated FacebookSdk.sdkInitialize()
in the application on create the following error occurs:
java.lang.NoClassDefFoundError: Failed resolution of:
Lcom/facebook/common/R$layout; at
com.facebook.FacebookActivity.onCreate(FacebookActivity.java:77)
at android.app.Activity.performCreate(Activity.java:6684) at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
P.S: I get an error when trying to use the Facebook login button
Error inflating class com.facebook.login.widget.LoginButton