我创建了自定义 buildTypes,如下所示:
buildTypes {
releasefree.initWith(buildTypes.release)
releasefree {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
releasepro.initWith(buildTypes.release)
releasepro {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".pro"
}
debugfree.initWith(buildTypes.debug)
debugfree {
shrinkResources true
applicationIdSuffix ".debug"
debuggable true
}
debugpro.initWith(buildTypes.debug)
debugpro {
shrinkResources true
applicationIdSuffix ".pro.debug"
debuggable true
}
}
我永远不会使用默认的调试和发布构建类型,并希望将它们从构建变体列表中删除。我有不止几种口味,而且变种的列表太大了。删除具有默认调试和发布类型的变体将有所帮助,因为我永远不会使用它们。
我尝试如下使用变体过滤器,但它不起作用
android.variantFilter { variant ->
if(variant.buildType.name.endsWith('Release') || variant.buildType.name.endsWith('Debug')) {
variant.setIgnore(true);
}
}
我过滤变体的方式是否有问题,或者是否无法使用默认调试和发布构建类型删除变体。