无法获取提供程序com.google.android.gms.ads.MobileAdsInitProvider:java.lang.IllegalStateException:

时间:2020-07-19 20:47:38

标签: java android

我已经从GoogleAdMob添加了正确的内容,但仍显示错误! 我第一次使用firbase 请帮忙! 谢谢:)

2020-07-20 02:13:21.137 17360-17360 / com.example.expensemanager E / AndroidRuntime:FATAL EXCEPTION:main 流程:com.example.expensemanager,PID:17360 java.lang.RuntimeException:无法获取提供程序com.google.android.gms.ads.MobileAdsInitProvider:java.lang.IllegalStateException:

******************************************************************************
* Invalid application ID. Follow instructions here:                          *
* https://googlemobileadssdk.page.link/admob-android-update-manifest         *
* to find your app ID.                                                       *

2 个答案:

答案 0 :(得分:0)

只需检查元数据标签是否超出活动标签

如果是这样

<manifest>
    <application>
        <activity>
            <meta-data> 
                android:name="com.google.android.gms.ads.APPLICATION_ID" 
                android:value="ca-app-pub-4347201915048498~6120388314"/>
        </activity>
    </application>
</manifest>

这个应该改成这个

<manifest>
    <application>
        <activity>
        </activity>
        <meta-data 
            android:name="com.google.android.gms.ads.APPLICATION_ID" 
            android:value="ca-app-pub-4347201915048498~6120388314"/>
    </application>
</manifest>

答案 1 :(得分:-1)

在清单文件的application标签内,放置以下代码

<application>
        <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
             
            /// pass the key generated from your admob which contains ~(APP ID)
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/> // 
    </application>