Android SDK生成时,自定义文件名称,而非系统第一分配的app-release.apk

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            signingConfig getSigningConfig()
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    def newName = output.outputFile.name
                    newName = newName.replace("app-release", "ZQUNYAN-release-" + "${variant.versionName}")
                    output.outputFile = new File(output.outputFile.parent, newName)
                }
            }

        }
    }

在build.gradle文件中buildTypes节点下增加如上代码,其中newName变量即为新生成文件的名称,个人根据需要进行相应的修改!

posted @ 2016-05-16 15:55  曲幽  阅读(291)  评论(0编辑  收藏  举报