I'm creating a simple app that plays an ad when a button is pressed. Though when I try to initialize Google Mobile Ads SDK, it fails everytime even though I've done every step in the guides provided be Google.

    <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme"
            tools:ignore="GoogleAppIndexingWarning">
            <meta-data
                android:name="com.google.android.gms.ads.Application_id"
                android:value="ca-app-pub-################~##########"/>
            <activity android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

I get this when i try to run the app

   ******************************************************************************
    * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
    * should follow the instructions here: Link to add a valid  *
    * App ID inside the AndroidManifest. Google Ad Manager publishers should     *
    * follow instructions here: Link.                           *
    ******************************************************************************


        at com.google.android.gms.internal.ads.zzabg.attachInfo(Unknown Source:16)
        at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source:3)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6724)
            ... 10 more

2 Answers

0
Dinesh Shingadiya On Best Solutions

Replace

<meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="ca-app-pub-################~##########"/>

Instead of:

<meta-data
    android:name="com.google.android.gms.ads.Application_id"
    android:value="ca-app-pub-################~##########"/>
0
Community On

Set android:value="true"

in meta data of AdMob