当我把“播放服务广告”时,实现'com.android.support:appcompat-v7:27.1.1'会出错

问题描述 投票:0回答:1
dependencies {
    implementation "org.jetbrains.anko:anko-commons:$anko_version"

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    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:espressocore:3.0.2'
}

这些是我的代码。


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

但是,当我添加此AdMob代码时,

implementation 'com.android.support:appcompat-v7:27.1.1'

此代码出错:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 26.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:customtabs:26.1.0 less... (Ctrl+F1) 
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can

我能做什么?

android android-gradle admob
1个回答
1
投票

这可能是因为implementation 'com.google.android.gms:play-services-ads:17.1.1' 暗中使用support libraries 26.1.0。您可以通过添加冲突库的确切版本来覆盖库。添加如下内容:

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:appcompat-v7:customtabs:27.1.1'
© www.soinside.com 2019 - 2024. All rights reserved.