【问题标题】:Gradle mixing versions 27.1.1 and 26.1.0 [Android Studio]Gradle 混合版本 27.1.1 和 26.1.0 [Android Studio]
【发布时间】:2019-01-08 09:26:05
【问题描述】:

对于 build.gradle 配置,一切正常。

compileSdkVersion 26
defaultConfig {
    applicationId "com.my.app"
    minSdkVersion 16
    targetSdkVersion 26
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

dependencies {
implementation project(':market_licensing')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:design:26.1.0'
implementation "com.android.support:appcompat-v7:26.1.0"
}

当我迁移到版本 27 时,

compileSdkVersion 27
defaultConfig {
    applicationId "com.my.app"
    minSdkVersion 16
    targetSdkVersion 27
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

dependencies {
implementation project(':market_licensing')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:design:27.1.1'
implementation "com.android.support:appcompat-v7:27.1.1"
}  

我有一个错误:

所有 com.android.support 库必须使用完全相同的版本 规范(混合版本可能导致运行时崩溃)。成立 版本 27.1.1、26.1.0。

为什么我仍然显示与旧版本 26.1.0 的冲突?我很干净。

【问题讨论】:

标签: java android android-studio


【解决方案1】:

customtabs需要在27.1.1版本中提供...

implementation "com.android.support:customtabs:27.1.1"
implementation ("com.google.android.gms:play-services-ads:17.1.2") {
    exclude group: "com.android.support", module: "customtabs"
}

【讨论】:

  • 错误已被消除。您的提示有所帮助。谢谢
【解决方案2】:

尝试清理并重建您的项目。此外,如果它不起作用,请检查所有依赖项是否相同,并可能将版本更改为新的或旧的。

我也强烈推荐使用 androidX,感觉真的很好

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-08
    • 2019-05-10
    • 2019-03-08
    • 2018-10-11
    相关资源
    最近更新 更多