Put
gradle.projectsEvaluated {
proguardDebugTest.enabled = false
}
it in your build script.
There are two things to know here:
- The general Gradle feature to enable / disable tasks.
- The Android Gradle plugin specific deferred creation of tasks in
afterEvaluate
, so you need to also defer disabling of the task toafterEvaluate
.
EDIT:
One small note: It disables the task but fails the build. This is because the :preDexDebugTest task wont run with proguard on. The best solution i've found so far is to have debug specific proguard config. More details here. Create a separate proguard config file, include the regular proguard file like so:
-include proguard.cfg
and add test config. For me it was:
-dontwarn org.mockito.**
-dontwarn sun.reflect.**
-dontwarn android.test.**