1. RAE首页
  2. Android

Android Studio APK输出文件配置

android{
  applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def outputFile = output.outputFile
            if (outputFile != null && outputFile.name.endsWith('.apk')) {
                def dirName = APP_OUTPUT_DIR + "v${defaultConfig.versionName}"
                def fileName = outputFile.name.replace(".apk", "-${defaultConfig.versionName}.apk")
                output.outputFile = new File(dirName, fileName)
            }
        }
    }

APP_OUTPUT_DIRgradle.properties,如:

#小盘beta版 输出路径
APP_OUTPUT_DIR = F\:\\100bei\\xiaopan\\dev\\

原创文章,作者:RAE,来自:https://raeblog.com,如若转载,请注明出处!