facebookflutterdartfacebook-analytics

Firebase dynamic links missing plugin exception after adding facebook app events package flutter


In my flutter application I have implemented firebase dynamic links and it works perfectly. After I added facebook_app_events package, the app built and ran normally but anything related to firebase dynamic links is not working giving this error:

Launching lib\main.dart on SM G930V in debug mode...
Plugin project :firebase_core_web not found. Please update settings.gradle.
√ Built build\app\outputs\flutter-apk\app-debug.apk.
W/FlutterActivity( 8798): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@90d680) but could not find and invoke the GeneratedPluginRegistrant.
E/FlutterFcmService( 8798): Fatal: failed to find callback
Connecting to VM Service at ws://127.0.0.1:4725/ji05M87o10Q=/ws
D/libGLESv2( 8798): STS_GLApi : DTS, ODTC are not allowed for Package : qcard.club
I/flutter ( 8798): error:MissingPluginException(No implementation found for method FirebaseDynamicLinks#getInitialLink on channel plugins.flutter.io/firebase_dynamic_links)
I/zygote64( 8798): Do partial code cache collection, code=60KB, data=47KB
I/zygote64( 8798): After code cache collection, code=60KB, data=47KB
I/zygote64( 8798): Increasing code cache capacity to 256KB

After removing the facebook app events package everything returns to normal. I have opened an issue over github but it did result in much info. This is the link towards it: https://github.com/FirebaseExtended/flutterfire/issues/3092

Update:

My strings.xml file:

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

Androidmanifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.qcard"
    xmlns:tools="http://schemas.android.com/tools">>
    
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="Qcard"
        android:icon="@mipmap/ic_launcher"
        tools:replace="android:label">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
              <action android:name="FLUTTER_NOTIFICATION_CLICK" />
              <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:name="com.apptreesoftware.flutterwebview.WebViewActivity">
</activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
     <meta-data
          android:name="com.facebook.sdk.ApplicationId"
          android:value="@string/facebook_app_id"/>
</manifest>

Solution

  • First of all, the Facebook App ID meta-data should be inside of your <application> tags.

    See the bottom of your pasted Android Manifest and change it to

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

    Second of all, I'm not sure if you just obfuscated your Facebook ID or if you mean that you literally put app_id as your Facebook App ID?

    Your facebook App ID should be something like a string of 16 digits.

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