如何获取android studio中build.gradle的项目名称?
buildTypes { release { applicationVariants.all { variant -> variant.outputs.each { output -> String projectName = project.name } } } }
xxb16uws1#
app-release.apk可以替换为您的项目名称.apk
buildTypes { release { applicationVariants.all { variant -> variant.outputs.each { output -> String projectName = getRootProject().name output.outputFileName = projectName + ".apk" } }
或
buildTypes { release { applicationVariants.all { variant -> variant.outputs.each { output -> output.outputFileName = getRootProject().name + ".apk" } }
1条答案
按热度按时间xxb16uws1#
app-release.apk可以替换为您的项目名称.apk
或