Android多服务器同时打包多个apk

Android多服务器同时打包多个apk

build.gradle中配置

flavorDimensions "default"
    productFlavors {
        lottery_nearlyThree{ // 开发环境: 101.201.152.232
            dimension "default"
            manifestPlaceholders = [CHANNEL_VALUE: "lottery_nearlyThree"]
            buildConfigField "String", "CHANNEL", "\"lottery_nearlyThree\""
            // true:使用网络下发域名和APPID;false:使用下面配置的域名和APPID
            buildConfigField "boolean", "DOMAIN_SWITCH", "false"
            buildConfigField "String", "DOMAIN_HOST", "\"http://118.190.151.52\""
            buildConfigField "String", "DOMAIN_APPID", "\"\""

            //741add67bc72c6c4dde4
        }
        lottery_nearlyEight{ // 开发环境: 101.201.152.232
            dimension "default"
            manifestPlaceholders = [CHANNEL_VALUE: "lottery_nearlyEight"]
            buildConfigField "String", "CHANNEL", "\"lottery_nearlyEight\""
            // true:使用网络下发域名和APPID;false:使用下面配置的域名和APPID
            buildConfigField "boolean", "DOMAIN_SWITCH", "false"
            buildConfigField "String", "DOMAIN_HOST", "\"http://118.190.151.52\""
            buildConfigField "String", "DOMAIN_APPID", "\"\""

            //741add67bc72c6c4dde4
        }
        dingding { // Azure: 139.219.6.208
            dimension "default"
            manifestPlaceholders = [CHANNEL_VALUE: "dingding"]
            buildConfigField "String", "CHANNEL", "\"dingding\""
            // true:使用网络下发域名和APPID;false:使用下面配置的域名和APPID
            buildConfigField "boolean", "DOMAIN_SWITCH", "false"
            buildConfigField "String", "DOMAIN_HOST", "\"https://dinglw.zzdingyun.com\""
            buildConfigField "String", "DOMAIN_APPID", "\"\""
        }

    }

修改apk的路径和名字

applicationVariants.all { variant ->
        def appName = 'LargeScreen-TV'
        def buildName
        variant.productFlavors.each { product ->
            buildName = product.name
        }
        String type = variant.buildType.name.replace("zhongtou_", "")
        variant.outputs.all {
            outputFileName = "${appName}" +
                    "-v${defaultConfig.versionName}" +
                    "-${buildName}" +
                    "-${type}" +
                    "-${releaseTime()}" +
                    ".apk"
            /* String path = variant.getPackageApplication().outputDirectory.getAbsolutePath()
            path = path.substring(0, path.lastIndexOf("/")) + "/ " + type
            variant.getPackageApplication().outputDirectory = new File(path)*/
        }
    }
project中build.gradle中配置
def releaseTime() {
    return new Date().format("yyyyMMddHHmm", TimeZone.getTimeZone("Asia/Shanghai"))
}

####清单文件中application中


        

你可能感兴趣的:(Android多服务器同时打包多个apk)