Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Dependency on firebase_ui makes app crash on startup #6

Open
aberent opened this issue Jun 7, 2019 · 2 comments
Open

Dependency on firebase_ui makes app crash on startup #6

aberent opened this issue Jun 7, 2019 · 2 comments

Comments

@aberent
Copy link

aberent commented Jun 7, 2019

When I tried to use firebase_ui my Android app started to crash on startup. Having removed all the firebase_ui code from the app it still crashed on startup. On further investigation I discovered it crashed if, and only if, firebase_ui was included in the dependencies in pubspec.yaml.

The error in the logcat is:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xxx_dummy/com.xxx.xxx_dummy.MainActivity}: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.

Why does adding firebase_ui (unused) to the dependencies require me to initialise FacebookSdk?

@LazyDave76
Copy link

Hey There @aberent, I had the same problem as you - added the firebase_ui dependency to my pubspec and Boom! the example flutter app broke.

After scratching about on the 'net, I found an implementation guide for android that suggests adding additional meta-data to the AndroidManifest.xml file so it looks something like this:

<application
        android:name="io.flutter.app.FlutterApplication"
        android:label="flutter_app"
        android:icon="@mipmap/ic_launcher">
 
   <meta-data android:name="com.facebook.sdk.ApplicationId" 
            android:value="@string/facebook_app_id"/>
 
   <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            .....>
            ....
    </activity>

an additional res/strings.xml file needs to be created with this in:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="facebook_app_id">0</string>
    <string name="fb_login_protocol_scheme">0</string>
</resources>

Obviously, this doesn't answer the original question but does treat the symptom. You will see lots of errors in your console that look like this :
E/GraphResponse( 4069): {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}

But at least your app will run.

Hope this helps!

@daniele-sforza
Copy link
Contributor

Hey There @aberent, I had the same problem as you - added the firebase_ui dependency to my pubspec and Boom! the example flutter app broke.

After scratching about on the 'net, I found an implementation guide for android that suggests adding additional meta-data to the AndroidManifest.xml file so it looks something like this:

<application
        android:name="io.flutter.app.FlutterApplication"
        android:label="flutter_app"
        android:icon="@mipmap/ic_launcher">
 
   <meta-data android:name="com.facebook.sdk.ApplicationId" 
            android:value="@string/facebook_app_id"/>
 
   <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            .....>
            ....
    </activity>

an additional res/strings.xml file needs to be created with this in:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="facebook_app_id">0</string>
    <string name="fb_login_protocol_scheme">0</string>
</resources>

Obviously, this doesn't answer the original question but does treat the symptom. You will see lots of errors in your console that look like this :
E/GraphResponse( 4069): {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}

But at least your app will run.

Hope this helps!

Thanks for this. I was having this issue and I can run my app now.
The strings.xml file has to be created under res/values/ though

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants