Android:如何使用支持25.0.0的Espresso 2.2.2? [英] Android: how to use Espresso 2.2.2 with Support 25.0.0?
问题描述
依赖关系{
compile'com.android.support:design:25.0.0'
compile' com.android.support:support-v4:25.0.0'
编译文件('libs / slf4j-android-1.5.8.jar')
androidTestCompile'com.android.support:support-annotations :25.0.0'
androidTestCompile('com.android.support.test:rules:0.5')
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2' )
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
})
}
我收到了以下消息:
警告:与依赖关系'com.android.support:recyclerview-v7'冲突。应用程序(25.0.0)和测试应用程序(23.1.1)的已解决版本不同。请参阅 http://g.co/androidstudio/app-test-app-conflict了解详情。
警告:与依赖关系'com.android.support:support-v4'冲突。应用程序(25.0.0)和测试应用程序(23.1.1)的已解决版本不同。请参阅 http://g.co/androidstudio/app-test-app-conflict了解详情。
警告:与依赖关系'com.android.support:appcompat-v7'冲突。应用程序(25.0.0)和测试应用程序(23.1.1)的已解决版本不同。请参阅 http://g.co/androidstudio/app-test-app-conflict了解详情。
警告:与依赖关系'com.android.support:design'冲突。应用程序(25.0.0)和测试应用程序(23.1.1)的已解决版本不同。请参阅 http://g.co/androidstudio/app-test-app-conflict了解详情。
第1步:我尝试使用排除组...无法使用。 第二步:我也尝试了不同的策略,例如:
configurations.all {
resolutionStrategy {
force'com.android.support:support-annotations:23.1.1'
}
}
第3步 :当然,我尝试了第一个gradlew:app:dependenices等,但那个一直在崩溃。是的,我使用JDK1.8。这是自夏天以来尚未解决的注册缺陷。
顺便说一句... Android,支持套餐和Espresso都是Google推出的?
试试
依赖项{
compile'com.android.support:design:25.0.0'
编译'com.android.support:support-v4:25.0.0'
编译文件('libs / slf4j-android-1.5.8.jar')
androidTestCompile'com.android.support:support-annotations:25.0.0'
androidTestCompile('com.android.support.test:rules:0.5' ){
exclude module:'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2'){
排除模块:'espresso-core'
排除模块:'support-v4'
排除模块:'recyclerview-v7'
排除模块:'appcompat-v7'
排除模块:'support-annotations'
排除模块:'design'
}
androidTestCompile('com.android.support.test.espresso:espresso-core :2.2.2'){
排除模块:'rules'
排除模块:'javax.annotation-api'
排除模块:'support-annotations'
}
这是我的工作设置 - 您基本上排除了所有Espresso依赖项的支持注释,并让它们使用已解决的注释来自您的标准运行时依赖关系。其他一些依赖造成了我的麻烦,所以我只是将它们排除在外,让构建从明确的 compile
语句解决它们。
How can I get this working? I read many similar strategies, alas. Using a support lib higher than 23.1.1 fails times and again.
dependencies {
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile files('libs/slf4j-android-1.5.8.jar')
androidTestCompile 'com.android.support:support-annotations:25.0.0'
androidTestCompile( 'com.android.support.test:rules:0.5')
androidTestCompile( 'com.android.support.test.espresso:espresso-contrib:2.2.2')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
I got this message:
Warning:Conflict with dependency 'com.android.support:recyclerview-v7'. Resolved versions for app (25.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details. Warning:Conflict with dependency 'com.android.support:support-v4'. Resolved versions for app (25.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details. Warning:Conflict with dependency 'com.android.support:appcompat-v7'. Resolved versions for app (25.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details. Warning:Conflict with dependency 'com.android.support:design'. Resolved versions for app (25.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
STEP 1: I tried with the exclude group... did not work.
STEP 2: I also tried different strategies like: configurations.all { resolutionStrategy { force 'com.android.support:support-annotations:23.1.1' } }
STEP 3: Of course I tried first gradlew :app:dependenices, etc, but that one keeps on crashing. Yes, I use JDK1.8. It is a registered bug that has not been solved since summer.
By the way ... Android, support package and Espresso are all from Google?
Try
dependencies {
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile files('libs/slf4j-android-1.5.8.jar')
androidTestCompile 'com.android.support:support-annotations:25.0.0'
androidTestCompile('com.android.support.test:rules:0.5') {
exclude module: 'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2') {
exclude module: 'espresso-core'
exclude module: 'support-v4'
exclude module: 'recyclerview-v7'
exclude module: 'appcompat-v7'
exclude module: 'support-annotations'
exclude module: 'design'
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
exclude module: 'rules'
exclude module: 'javax.annotation-api'
exclude module: 'support-annotations'
}
That's my working setup - you essentially exclude support annotations from all Espresso dependencies and let them use the one that's been resolved from your standard runtime dependencies. Some other dependencies caused me trouble so I just exclude them as well and let the build resolve them from explicit compile
statements.
这篇关于Android:如何使用支持25.0.0的Espresso 2.2.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!