gpt4 book ai didi

android - 错误:与项目 'com.android.support:support-v4'中的依赖项 ':app'冲突。应用(25.3.1)和测试应用(23.1.1)的已解决版本不同

转载 作者:行者123 更新时间:2023-12-03 05:56:27 24 4
gpt4 key购买 nike

每当我尝试通过以下依赖项添加Esspreso UI测试库的依赖项以在为RecyclerView开发UI测试以获取RecyclerViewActions时使用此依赖项时,都会出现此错误。

 androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'

同时删除以前的依赖gradle构建完美
谁能帮助我解决这个问题?
我的gradle中的样本:
 dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
testCompile 'junit:junit:4.12'

compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'

compile 'com.google.android.exoplayer:exoplayer:r2.2.0'

androidTestCompile( 'com.android.support.test.espresso:espresso-intents:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile( 'com.android.support.test:rules:0.5', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile ('com.android.support.test:runner:0.5', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile ('com.android.support.test.espresso:espresso-web:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile( 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

}

Update

After googling for an hour I found the solution within Vogella by setting this dependency as following:


androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'recyclerview-v7'
}

最佳答案

这将解决您的问题:

androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2') {
exclude group: 'com.google.code.findbugs'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude module: 'recyclerview-v7'
}

您只需要排除 build.gradle中已经提供的每个库

关于android - 错误:与项目 'com.android.support:support-v4'中的依赖项 ':app'冲突。应用(25.3.1)和测试应用(23.1.1)的已解决版本不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44607716/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com