我正在创建一个简单的应用程序,按下按钮时会播放广告。 尽管当我尝试初始化 Google 移动广告 SDK 时,尽管我已完成 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>
当我尝试运行应用程序时收到此消息
******************************************************************************
* 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
最佳答案
替换
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-################~##########"/>
而不是:
<meta-data
android:name="com.google.android.gms.ads.Application_id"
android:value="ca-app-pub-################~##########"/>
关于java - 如何修复 Google 移动广告集成错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56106915/