junit 导入的 testCompile 和 androidTestCompile 之间的区别

Differences between testCompile and androidTestCompile for junit imports

这两个导入语句有什么区别? (在 build.gradle):

testCompile 'junit:junit:4.12'

androidTestCompile 'junit:junit:4.12'

有一个很好的答案 解释了不同之处:

Simply testCompile is the configuration for unit tests (located in src/test) and androidTestCompile is used for the test API (located in src/androidTest).

...

The main distinction between the two is the test sourceset runs in a regular Java JVM, whereas the androidTest sourceset tests run on an Android device (or an emulator).