簡體   English   中英

為什么“在Android中添加Admob廣告時出錯”?

[英]Why “Error While Adding Admob Ads In Android”?

嘗試在我的應用中添加Google廣告。

這是應用程序級別的build.gradle文件:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.student.shopifysalespediasample"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}

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

我在這一行中遇到錯誤

 implementation 'com.google.android.gms:play-services-ads:17.1.1'

錯誤顯示:

所有gms / firebase庫必須使用完全相同的版本規范(混合版本可能導致運行時崩潰)。 找到版本17.1.1,16.0.4,16.0.3,16.0.1,16.0.0。 示例包括com.google.android.gms:play-services-ads:17.1.1和com.google.android.gms:play-services-measurement-base:16.0.4

請幫忙,我的應用程序即將完成。 添加廣告的最后一步仍然是。 非常感謝您的幫助。 謝謝!

您的依賴版本不相同,請使用此依賴

implementation 'com.google.android.gms:play-services-ads:16.0.0'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM