2

I am working on Flutter application using facebook authentication. As per the first step I added flutter_facebook_login: ^2.0.1 in pubspec.yaml. And I tried to run in debug mode. I get the following error:

    Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:51195/1vmwn2gEVK8=/ws
3
  • Which version of Android are you using? Commented Jun 5, 2019 at 9:29
  • Physical device with Android Loplipop 5.1 or API level 21-22. Is this the right answer or you mean something else? Commented Jun 5, 2019 at 9:37
  • did you solve the problem? @leo-boy Commented Jun 11, 2019 at 11:50

1 Answer 1

3

I have solve this problem by following this steps.

Once you have the Facebook App ID figured out, youll have to do two things.

First, copy-paste the following to your strings resource file. If you don't have one, just create it.

\/android/app/src/main/res/values/strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Your App Name here.</string>

    <!-- Replace "000000000000" with your Facebook App ID here. -->
    <string name="facebook_app_id">000000000000</string>

    <!--
      Replace "000000000000" with your Facebook App ID here.
      **NOTE**: The scheme needs to start with `fb` and then your ID.
    -->
    <string name="fb_login_protocol_scheme">fb000000000000</string>
</resources>

Then you'll just have to copy-paste the following to your Android Manifest:

\/android/app/src/main/AndroidManifest.xml

<meta-data android:name="com.facebook.sdk.ApplicationId"
    android:value="@string/facebook_app_id"/>

<activity android:name="com.facebook.FacebookActivity"
    android:configChanges=
            "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name" />

<activity
    android:name="com.facebook.CustomTabActivity"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="@string/fb_login_protocol_scheme" />
    </intent-filter>
</activity>
Sign up to request clarification or add additional context in comments.

1 Comment

remember to do a gradle sync

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.