outputFileName正确使用

android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            //开始输出
            def file = output.outputFileName
            def newName = "";
            def channelName = variant.productFlavors[0].name
            def versionName = android.defaultConfig.versionName
            if (variant.buildType.zipAlignEnabled) {
                newName = "SmartCabinet" + "-" + channelName + "-" + versionName + "-release.apk"
            } else {
                newName = "SmartCabinet" + "-" + channelName + "-" + versionName + "-release-unalign.apk"
            }
           // output.outputFileName  = new File(file.parent, newName)
            output.outputFileName  = newName
        }
    }

你可能感兴趣的:(outputFileName正确使用)