简体   繁体   中英

After add implementation 'com.google.android.gms:play-services-ads:17.0.0 app running error

After I add implementation com.google.android.gms:play-services-ads:17.0.0 app running error. Here is the code

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'
}

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM