简体   繁体   中英

exclude junit lib from building apk in android studio

I have Android studio projected imported from eclipse. 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. How do i exclude this junit library from .apk? 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; androidTestCompile for instrumentation test dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM