How to make Android Studio 1.1 call generateDebugTestSources instead of assembleDebugTest during “Make” instruction?

怎甘沉沦 提交于 2019-12-19 04:11:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!