Android Gradle for Android Ignoring build variant

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


For some reasons you may want to ignore your build variants. For example: you have 'mock' product flavour and you use it only for debug purposes, such as unit/instrumentation tests.

Let's ignore mockRelease variant from our project. Open build.gradle file and write:

    // Remove mockRelease as it's not needed.
    android.variantFilter { variant ->
        if ('release') && variant.getFlavors().get(0).name.equals('mock')) {

Got any Android Question?