为了账号安全,请及时绑定邮箱和手机立即绑定

应用(22.0.0)和测试应用(21.0.3)的已解决版本不同

应用(22.0.0)和测试应用(21.0.3)的已解决版本不同

回首忆惘然 2019-12-10 13:08:41
升级到API 22并支持lib版本22后,我收到以下警告:警告:与依赖项“ com.android.support:support-annotations”冲突。应用(22.0.0)和测试应用(21.0.3)的已解决版本不同。Gradle本身更宽容,但Android Studio却不那么多。我没有用21.0.3声明的依赖项...是使用21.0.3的依赖库之一,Google忘记用其余的批处理更新它吗?我build.gradle的临时演员被削减了android {  compileSdkVersion 22  buildToolsVersion '22'  defaultConfig {    applicationId "com.REDACTED.android"    minSdkVersion 14    targetSdkVersion 22    renderscriptSupportModeEnabled true    versionName '1.0.0'    versionCode 100  }  buildTypes {    release {      minifyEnabled true      zipAlignEnabled true      signingConfig signingConfigs.release    }    debug {      minifyEnabled false      zipAlignEnabled true      signingConfig signingConfigs.debug    }  }  dependencies {    provided 'org.projectlombok:lombok:1.16.2'    googleCompile 'com.google.android.gms:play-services-base:6.5.87'    compile 'com.android.support:support-v4:22.0.0'    compile 'com.android.support:appcompat-v7:22.0.0'    compile 'com.android.support:support-v13:22.0.0'    compile 'com.android.support:cardview-v7:22.0.0'    compile 'com.android.support:palette-v7:22.0.0'    compile 'com.android.support:support-annotations:22.0.0'    compile 'com.github.chrisbanes.photoview:library:1.2.3'    compile 'org.apache.commons:commons-lang3:3.3.2'    compile 'commons-io:commons-io:2.4'    compile 'commons-codec:commons-codec:1.10'    compile 'com.jakewharton:butterknife:6.1.0'    compile 'com.jakewharton:disklrucache:2.0.2'    compile 'com.squareup:otto:1.3.6'    compile 'com.squareup.picasso:picasso:2.5.0'    compile 'com.squareup.retrofit:retrofit:1.9.0'    compile 'com.squareup.okhttp:okhttp:2.2.0'  }
查看完整描述

3 回答

?
跃然一笑

TA贡献1826条经验 获得超6个赞

处理此类问题时的第1步是熟悉命令行Gradle。


步骤2是运行Gradle依赖关系报告(例如,gradle -q app:dependencies从项目根目录开始)。这将提供ASCII树,如问题的更新中所示,它应有助于您确定导致冲突的工件版本的原因。


步骤#3是确定需要替换的内容。您选择仅替换冲突(support-annotations)。就我个人而言,我会选择错误版本树(recyclerview-v7)的根,尽管就我所知,在这种情况下,这可能不是最佳的选择。


步骤4是添加exclude指令以阻止您在步骤3中选择的内容:


androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.0') {

    exclude module: 'support-annotations'

}

步骤#5是测试此更改的内容。您正在说的是espresso-contrib 必须处理的22.0.0版本support-annotations。那可能行得通。那可能不会。这取决于冲突的向后兼容性。在这种情况下,support-annotations应该对此做得很好。


第6步是饮用您选择的饮料,一种适合您所在地区和一天中不同时间的饮料。



查看完整回答
反对 回复 2019-12-11
  • 3 回答
  • 0 关注
  • 390 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信