sourceSets
已经不适合gradle7以上的版本了
以下方法可以,但会导致资源编译失败, 适合空activity的APP
在build.gradle
中添加
project.afterEvaluate {
android.applicationVariants.forEach {
variant ->
def variantCapped = variant.name.capitalize()
def variantLowered = variant.name.toLowerCase()
println("afterEvaluate applicationVariants: ${variantCapped} - ${variantLowered} - ${variant.outputs[0].outputFile}")
def replaceRJar = task("removeRjava${variantCapped}") {
doFirst {
println("write blank jar to R.jar"