cop*_*lii 179 android android-support-library
升级到API 22并支持lib版本22后,我收到以下警告:
警告:与依赖项"com.android.support:support-annotations"冲突.app(22.0.0)和测试app(21.0.3)的已解决版本有所不同.
Gradle本身更宽容,但Android Studio并没有那么多.
我没有使用21.0.3声明的依赖项...是使用21.0.3的依赖库之一而谷歌忘了用批处理的其余部分更新它?
我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'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okio:okio:1.2.0'
compile 'com.flaviofaria:kenburnsview:1.0.6'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.getbase:floatingactionbutton:1.8.0'
compile 'com.nispok:snackbar:2.10.2'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.9'
compile 'de.hdodenhof:circleimageview:1.2.2'
compile fileTree(dir: 'libs', include: '*.jar')
// Test Only Dependencies
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.0'
}
Run Code Online (Sandbox Code Playgroud)
更新:(谢谢马克)
看起来像是espresso-contrib
+--- com.android.support.test:testing-support-lib:0.1 (*)
\--- com.android.support.test.espresso:espresso-contrib:2.0
+--- com.android.support:recyclerview-v7:21.0.3
| +--- com.android.support:support-annotations:21.0.3
| \--- com.android.support:support-v4:21.0.3
| \--- com.android.support:support-annotations:21.0.3
+--- com.android.support:support-v4:21.0.3 (*)
\--- com.android.support.test.espresso:espresso-core:2.0 (*)
Run Code Online (Sandbox Code Playgroud)
Com*_*are 286
处理此类事情的步骤#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'
}
Run Code Online (Sandbox Code Playgroud)
第五步是测试这个变化.你正在做的是说espresso-contrib 必须处理22.0.0版本support-annotations.这可能有用.那可能不是.这取决于冲突的向后兼容性.在这种情况下,support-annotations应该是相当不错的.
步骤#6是使用您选择的饮料,一种适合您所在地区和时间的饮料.
Ren*_*ery 146
我做的是解决它是在我的build.gradle脚本中添加以下行
androidTestCompile 'com.android.support:support-annotations:xx.x.x'
Run Code Online (Sandbox Code Playgroud)
替换xx.x.x为您的应用正在使用的任何版本的支持注释 - 这将在您的依赖项中显示,或者Gradle同步消息显示为:Resolved version for app (xx.x.x)如果同步有问题.
小智 58
实际上这是Espresso Contrib的新更新版本的错误,你可以参考这个解决方法:android-testing/build.gradle
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:22.1.0'
}
Run Code Online (Sandbox Code Playgroud)
mar*_*385 23
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.1.1'
}
}
Run Code Online (Sandbox Code Playgroud)
这解决了我的问题.
或者你可以在windows上运行gradlew,在./gradlew上运行mac/linux,这将在需要时下载你的依赖项
我也遇到了这个问题以及涉及appcompat的其他冲突,我发现的解决方案是添加测试编译并将它们设置为您当前使用的sdk.在我的情况下它是25,所以它看起来像这样:
androidTestCompile 'com.android.support:support-annotations:25.+'
androidTestCompile 'com.android.support:appcompat-v7:25.+'
androidTestCompile 'com.android.support:support-v4:25.+'
androidTestCompile 'com.android.support:recyclerview-v7:25.+'
androidTestCompile 'com.android.support:design:25.+'
Run Code Online (Sandbox Code Playgroud)
此外,正如您所看到的,我添加了与Android Material Design相关的设计依赖项.
希望它有帮助=)
对于sdkversion 25
androidTestCompile 'com.android.support:support-annotations:25.2.0'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
92239 次 |
| 最近记录: |