我有多种口味和构建类型,因此我有多个firebaseUpload任务:

firebaseUploadFlavor1BetaProguardMapping
firebaseUploadFlavor1StagingProguardMapping
firebaseUploadFlavor1ReleaseProguardMapping

firebaseUploadFlavor2BetaProguardMapping
firebaseUploadFlavor2StagingProguardMapping
firebaseUploadFlavor2ReleaseProguardMapping


不幸的是,没有firebaseUploadBetaProguardMapping或类似的任务。是否可以创建自己的任务,该任务将自动上载所有风味和构建类型的所有proguard文件?

最佳答案

我通过将以下代码添加到我的应用程序的build.gradle文件中来解决此问题:

task uploadProguardMappings {
    println "Uploading Firebase Proguard Mapping Files"
}

android.applicationVariants.all { variant ->

    def flavor = variant.flavorName.capitalize()
    def buildType = variant.getBuildType().name.capitalize()

    if(!buildType.equals("Debug")) {
        println "firebaseUpload" + flavor + buildType + "ProguardMapping"
        uploadProguardMappings.dependsOn "firebaseUpload" + flavor + buildType + "ProguardMapping"
    }
}

关于android - 将ProGuard映射文件上载到Firebase以获得多种版本和构建类型,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42717468/

10-10 18:44