My decision was inspired by this answer to the corresponding question. Here's how you do it:
in the application /build.gradle
// Reset `resConfigs` for release afterEvaluate { android.applicationVariants.all { variant -> if (variant.buildType.name.equals('release')) { variant.mergedFlavor.@mResourceConfiguration = null } } }
This works because mResourceConfiguration is a support field for resConfigs . Unfortunately, the DSL in Android Gradle does not currently set the reset resConfigs method, so we have to directly access the field using the groovy @<fieldName> syntax. This works, although mResourceConfiguration is private.
WARNING : this solution is a bit fragile, as the Android Gradle tool development team can change the name of this field at any time, because it is not part of the public API.
source share