我怎样才能使这个工作?我读了很多类似的策略,唉。使用高于23.1.1的支持库会一次又一次失败。
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'
})
}
我收到了这条消息:
警告:与依赖项冲突&com.android.support:recyclerview-v7'。 app(25.0.0)和测试app(23.1.1)的已解决版本有所不同。有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict。 警告:与依赖性冲突&com.android.support:support-v4'。 app(25.0.0)和测试app(23.1.1)的已解决版本有所不同。有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict。 警告:与依赖项冲突&com.android.support:appcompat-v7'。 app(25.0.0)和测试app(23.1.1)的已解决版本有所不同。有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict。 警告:与依赖项冲突&com.android.support:design'。 app(25.0.0)和测试app(23.1.1)的已解决版本有所不同。有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict。
第1步:我尝试使用排除组...无效。
第2步:我也尝试过不同的策略: configurations.all { resolutionStrategy { force' com.android.support:support-annotations:23.1.1' } }
第3步:当然我尝试了第一个gradlew:app:dependenices等,但是那个一直在崩溃。是的,我使用的是JDK1.8。这是一个注册的bug,自夏天以来一直没有解决。
顺便说一句...... Android,支持包和Espresso都来自谷歌?
答案 0 :(得分:11)
尝试
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'
}
这是我的工作设置 - 您基本上从所有Espresso依赖项中排除支持注释,并让它们使用从标准运行时依赖项中解析出来的那个。其他一些依赖项给我带来了麻烦,所以我只是将它们排除在外,让构建从显式compile
语句中解析它们。