我的环境如下:android studio 2.3
第一次启动工程,studio 会编译junit 这个包
网上有很多解决方法,有的人是在build.gradle 中这样改动:
repositories {
maven { url 'http://repo1.maven.org/maven2' }
jcenter { url "http://jcenter.bintray.com/" }
}
或者注释掉:
testCompile 'junit:junit:4.12'
正确的决解是将
testCompile ---> androidTestCompile
如图:
本文介绍如何解决Android Studio 2.3版本中首次启动项目时出现的JUnit包编译错误。通过调整Gradle配置文件中的依赖项,将testCompile更改为androidTestCompile,以确保单元测试仅在Android测试环境中编译。

4933

被折叠的 条评论
为什么被折叠?



