-1

添加实现com.google.android.gms:play-services-ads:17.0.0应用程序运行错误后。这是代码

dependencies {
  implementation fileTree(include: ['*.jar'], dir: 'libs')
  implementation 'com.android.support:appcompat-v7:26.1.0'
  implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  implementation 'com.google.android.gms:play-services-ads:17.0.0'
}
4

1 回答 1

1

Below step is required as of Google Mobile Ads SDK version 17.0.0. You can check release note here.

Failure to add below tag results in a crash with the message: "The Google Mobile Ads SDK was initialized incorrectly."


Update your AndroidManifest.xml

Add your AdMob App ID to your app's AndroidManifest.xml file by adding the tag shown below. You can find your App ID in the AdMob UI. For android:value insert your own AdMob App ID in quotes, as shown below.

<manifest>
    <application>
        <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="[ADMOB_APP_ID]"/>
    </application>
</manifest>
于 2018-11-08T07:57:32.750 回答