Put this code in your gradle script application:
tasks.whenTaskAdded { task -> if (task.name.equals("lint")) { //this is for speed up build task.enabled = false } if(task.name.contains("Test")) { //this is what you need task.enabled = false } }
When gradle adds a task, this code checks the name of the task. if this task is "lint" ( here), which does not need every assembly. if this task has the word "Task", we can skip if we want.
:app:preDebugAndroidTestBuild SKIPPED :app:compileDebugAndroidTestAidl SKIPPED :app:processDebugAndroidTestManifest SKIPPED :app:compileDebugAndroidTestRenderscript SKIPPED :app:generateDebugAndroidTestBuildConfig SKIPPED :app:generateDebugAndroidTestResValues SKIPPED :app:generateDebugAndroidTestResources SKIPPED :app:mergeDebugAndroidTestResources SKIPPED :app:splitsDiscoveryTaskDebugAndroidTest SKIPPED :app:processDebugAndroidTestResources SKIPPED :app:generateDebugAndroidTestSources SKIPPED
I do not know what these tasks are. But when I skip my project, it does not affect anything but speed (not so much because I do not have test files), which is a pain in the gradle build system.
Hope this helps you.
source share