Last active
December 1, 2020 17:54
-
-
Save artem-zinnatullin/ec3bce6dcb2cd524c435 to your computer and use it in GitHub Desktop.
Ignore particular buildType in Android Project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variant 1: For app or library project's build.gradle | |
android { | |
variantFilter { | |
if (it.buildType.name.equals('debug')) { | |
it.ignore = true | |
} | |
} | |
} | |
// Variant 2: For root build.gradle with applying only to library projects | |
// For example we use it for StorIO because we don't have debug-specific code | |
// It makes our build faster | |
allprojects { | |
project.plugins.whenPluginAdded { plugin -> | |
if ('com.android.build.gradle.LibraryPlugin'.equals(plugin.class.name)) { | |
project.android.variantFilter { | |
if (it.buildType.name.equals('debug')) { | |
it.ignore = true | |
} | |
} | |
} | |
} | |
} | |
// Source: https://groups.google.com/forum/#!topic/adt-dev/1ffLwedWTXc | |
// https://twitter.com/artem_zin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment