栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Android测试构建错误:多个dex文件定义了Landroid / support / test / BuildConfig

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Android测试构建错误:多个dex文件定义了Landroid / support / test / BuildConfig

更新(2015年9月7日):

如果使用以下排除项,则可以继续使用22.2.1:

androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2') {    exclude group: 'com.android.support', module: 'support-annotations'}androidTestCompile ('com.android.support.test:runner:0.3') {    exclude group: 'com.android.support', module: 'support-annotations'}androidTestCompile ('com.android.support.test:rules:0.3') {    exclude group: 'com.android.support', module: 'support-annotations'}

如果您依赖

espresso-contrib
,则还需要排除。

更新(8/03/2015):

使用支持库22.2.1,依赖关系再次被破坏。在发布新的亚军之前,请不要升级到22.2.1。

更新(6/04/2015):

在最新版本的运行器0.3和规则0.3中,不再需要此答案。您可以简单地使用

androidTestCompile 'com.android.support.test:runner:0.3'androidTestCompile 'com.android.support.test:rules:0.3'androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'

最新的支持库。(

22.2.0
截至撰写本文时)

更新(5/30/2015):

compile 'com.android.support:appcompat-v7:22.2.0'androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'// com.android.support.test:testing-support-lib:0.1 // <-- causes issue

更新(4/24/2015):

问题是与

com.android.support:support-v4:22.1.1
发生冲突
com.android.support.test:runner:0.2
(取决于
com.android.support:support-v4:22.0.0
)。

com.android.support.test.espresso:espresso-core:2.1
依赖于
com.android.support.test:runner:0.2
,因此也会导致相同的错误。

因此,此组合将起作用:

compile 'com.android.support:support-v4:22.0.0'androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'

…所以这个( 不带

'com.android.support.test:runner:0.2'
)也会这样:

compile 'com.android.support:support-v4:22.1.0'androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'

原始答案:

与Espresso文档所说的相反,您应该删除此依赖项:

androidTestCompile 'com.android.support.test:runner:0.2'

因为这是库版本冲突的原因。

您还应该更新至Android gradle插件1.1.1,因为该版本将告诉您确切的版本冲突,在这种情况下很有用。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/486623.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号