[英]exclude junit lib from building apk in android studio
I have Android studio projected imported from eclipse. 我有计划从eclipse导入的Android Studio。 I have started unit testing for this project. 我已经开始对该项目进行单元测试。 here are the dependency added, 这是添加的依赖项,
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// Unit testing dependencies
compile 'junit:junit:4.12'
// Set this dependency if you want to use Mockito
compile 'org.mockito:mockito-core:1.10.19'
// some more ..
}
when I am building .apk file, this .apk contains junit library. 当我构建.apk文件时,此.apk包含junit库。 How do i exclude this junit library from .apk? 如何从.apk中排除该junit库? I have searched for these question from last few days but could find solution. 最近几天我一直在搜索这些问题,但可以找到解决方案。 Please help me on this. 请帮我。
Use testCompile
instead of compile
for unit-test dependencies; 使用testCompile
而不是针对单元测试依赖项进行compile
; androidTestCompile
for instrumentation test dependencies. androidTestCompile
用于工具测试的依赖关系。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.