Skip to content

Instantly share code, notes, and snippets.

@artem-zinnatullin
Last active December 1, 2020 17:54
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save artem-zinnatullin/ec3bce6dcb2cd524c435 to your computer and use it in GitHub Desktop.
Save artem-zinnatullin/ec3bce6dcb2cd524c435 to your computer and use it in GitHub Desktop.
Ignore particular buildType in Android Project
// 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