关于AndroidStudio正式Apk的命名设置

AndroidStudio build.gradle可以设置生成的apk命名规则,再app下的build.gradle里(非根目录)如下


    buildTypes {
        debug {
            buildConfigField "boolean", "LOG_DEBUG", "true"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            buildConfigField "boolean", "LOG_DEBUG", "false"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            applicationVariants.all { variant ->
                variant.outputs.all { output ->
                    if (outputFileName  != null && outputFileName.endsWith('.apk')
                            && 'release'.equals(variant.buildType.name)) {
                        def apkFile = new File(
                                outputFileName,
                                "qianjidanjian_v${variant.versionCode}.apk")
                        outputFileName  = apkFile
                    }

                }
            }
        }
    }

你可能感兴趣的:(Android)