简体   繁体   中英

Facebook Login Integration With Flutter

I am trying to integrate facebook login with Flutter using the instructions provided here for android.

I think it is a official plugin , I have followed everything in this documentation but I am getting the following error and app crashes on Launch.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shrishtionline.quikpayagent/com.shrishtionline.quikpayagent.MainActivity}: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:203)
    at android.app.ActivityThread.main(ActivityThread.java:6251)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
 Caused by: 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.roughike.facebooklogin.facebooklogin.FacebookLoginPlugin$FacebookSignInDelegate.<init>(FacebookLoginPlugin.java:109)
    at com.roughike.facebooklogin.facebooklogin.FacebookLoginPlugin.<init>(FacebookLoginPlugin.java:38)
    at com.roughike.facebooklogin.facebooklogin.FacebookLoginPlugin.registerWith(FacebookLoginPlugin.java:42)
    at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:23)
    at com.shrishtionline.quikpayagent.MainActivity.onCreate(MainActivity.java:11)
    at android.app.Activity.performCreate(Activity.java:6666)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)

I have integrated google sign-in for both IOS and Android but I got stuck here in facebook login.

The error log says to call FacebookSdk.sdkInitialize() , But in dart I am not able to call this code. But I have initialized Facebook SDK with static final FacebookLogin facebookSignIn = new FacebookLogin(); method.

I have browsed a lot but I am not able to solve out this issue.

The plugin you mentioned is correct. I guess you have missed initializing the SDK according to the Error log.

I will recommend you to follow the steps from the below-mentioned tutorial written by Rohan Taneja.

Tutorial: https://medium.com/flutter-community/flutter-facebook-login-77fcd187242

The issue is solved. Just need to run flutter clean and re run the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM