多个dex文件定义Landroid/support/test/espresso/accessibility/R$attr;
在尝试运行UI测试(androidTest)后,我一直遇到以下错误 My gradle包含以下依赖项:多个dex文件定义Landroid/support/test/espresso/accessibility/R$attr;,android,android-gradle-plugin,android-espresso,android-multidex,Android,Android Gradle Plugin,Android Espresso,Android Multidex,在尝试运行UI测试(androidTest)后,我一直遇到以下错误 My gradle包含以下依赖项: androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso" androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$espresso" androidTestImplementati
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso"
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$espresso"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$espresso"
androidTestImplementation "com.android.support.test.espresso:espresso-accessibility:$espresso"
androidTestImplementation "com.android.support.test.espresso:espresso-web:$espresso"
androidTestImplementation "com.android.support.test.espresso:espresso-idling-resource:$espresso"
androidTestImplementation "com.android.support.test.espresso.idling:idling-concurrent:$espresso"
androidTestImplementation 'com.android.support:multidex-instrumentation:1.0.2'
- 浓缩咖啡3.0.1
请告知通过强制特定libs版本解决了此问题:
configurations.all {
resolutionStrategy {
// fail eagerly on version conflict (includes transitive dependencies)
// e.g. multiple different versions of the same dependency (group and name are equal)
failOnVersionConflict()
// prefer modules that are part of this build (multi-project or composite build) over external modules
preferProjectModules()
force 'com.android.support:appcompat-v7:27.0.1'
}
}
并使用此gradle命令查看依赖项树:
./gradlew -q dependencies :project_name:dependencies
libs文件夹中有jar文件吗?我刚刚在我的项目中尝试过,每次包含
espresso可访问性时都会出现此错误。如果您现在不需要它,您可以将其删除以自行解锁。我建议在这里提交一个bug:你能解决这个问题吗?我也一样,是的。问题已经解决了。
./gradlew -q dependencies :project_name:dependencies