Charles Jr
Charles Jr

Reputation: 9119

How to properly add Admob to a Flutter Project?

I have a Flutter project that uses the Firebase_Admob package. Everything works as expected for iOS, but my Android instance is receiving the following error...


* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
* App ID inside the AndroidManifest. Google Ad Manager publishers should     *
******************************************************************************

This is what my AndroidManifest looks like...

<application
        android:name="io.flutter.app.FlutterApplication"
        android:label="myfavkpopapp_example"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <meta-data
                    android:name="com.google.android.gms.ads.APPLICATION_ID"
                    android:value="ca-app-pub-[ADMOB ID]"/>
            <meta-data
                    android:name="com.google.android.gms.version"
                    android:value="@integer/google_play_services_version" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>

Upvotes: 0

Views: 650

Answers (2)

user12637469
user12637469

Reputation:

<meta-data
                android:name="com.google.android.gms.ads.APPLICATION_ID"
                android:value="ca-app-pub-[ADMOB ID]"/>

you put your app id to ca-app-pub-[ADMOB ID] and add internet permission

Upvotes: 0

GreatCallie
GreatCallie

Reputation: 17

You need to add your real admob id here:

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-[ADMOB ID]"/>

Upvotes: 1

Related Questions