android开发中Gradle使用相关

2018-11-30  本文已影响0人  焦世春

动态输出的包名

 android.applicationVariants.all { variant ->
        variant.outputs.all { output ->
            def outFile = output.outputFile
            if (outFile != null) {
                def isApkFile = outFile.name.endsWith('.apk')
                if (isApkFile) {
                    def flavorName = variant.productFlavors.get(0).name
                    def buildTypeName = variant.buildType.name
                    def outFileName = "appName"+buildTypeName+flavorName
                    outFileName = new File(outFileName + ".apk")
                }
            }
        }
    }
上一篇下一篇

猜你喜欢

热点阅读