问题
I have a project with 1,000+ tests running fine with Robolectric. After switching to Android Studio 1.1 when I go to "Run" -> "All Tests" during the "Make" instruction Android Studio calls Gradle's assembleDebugTest instead of generateDebugTestSources .. In my case this makes the build system to start dexing and packaging the test APK which is useless for me since all the tests are JVM tests.
I found this change that might be causing it:
- if (testCompileType == TestCompileType.ANDROID_TESTS) {
+ if (testCompileType != TestCompileType.NONE) {
String gradleTaskName = properties.ASSEMBLE_TEST_TASK_NAME;
if (StringUtil.isNotEmpty(gradleTaskName)) {
tasks.add(createBuildTask(gradlePath, gradleTaskName));
Is there a way to make it configurable on Android Studio? Version 1.0 was working fine.
Thanks!
回答1:
If someone is interested in the solution according to the new Unit Testing guide:
http://tools.android.com/tech-docs/unit-testing-support
you need to change the test artifacts to "Unit Testing" as describe on step 5. That way when you run all the tests AS will call the new assembleDebugUnitTest
task instead of assembleDebugTest
.
来源:https://stackoverflow.com/questions/28777705/how-to-make-android-studio-1-1-call-generatedebugtestsources-instead-of-assemble