问题
I need JUnit in both test folders. So I added
androidTestCompile 'junit:junit:4.12'
testCompile 'junit:junit:4.12'
But as soon as I add JUnit to the androidTest I cannot run the tests, because of the error thrownin this log.
Any ideas on how to fix this problem?
EDIT: I removed the gradle-aware build from the run configuration. Now it says that my TestSuite
is empty, but there are tests annotated with @Test
回答1:
Hava a try with this in your build.gradle file
dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
}
来源:https://stackoverflow.com/questions/43582318/cant-add-junit-to-test-and-androidtest