Android Studio 3.0.0 修改打包命名
2018-02-24 15:48
405 查看
Android Studio 3.0.0 引入了com.android.tools.build:gradle:3.0.0 插件,API发生了改变
plugin 3.0.0 新增了variant.outputs.all(Closure action)方法,测试时发现,variant.outputs.each(…)方法中找不到outputFileName ,只有variant.outputs.all(Closure action)才能找到outputFileName 变量
Plugin 3.0.0之前的打包命名修改
// 自定义APK安装包名 android.applicationVariants.all { variant -> variant.outputs.each { output -> if (buildType.name.equals("debug")) { output.outputFile = new File(output.outputFile.parent, "app-debug.apk") } if (buildType.name.equals("release")) { output.outputFile = new File(output.outputFile.parent, "app-release.apk") } } }
现在修改为
// 自定义APK安装包名 android.applicationVariants.all { variant -> variant.outputs.all { output -> def outputFile = output.outputFile if (outputFile.name.contains("debug")) { outputFileName = new File("../debug/", "app-debug.apk") } } }
plugin 3.0.0 新增了variant.outputs.all(Closure action)方法,测试时发现,variant.outputs.each(…)方法中找不到outputFileName ,只有variant.outputs.all(Closure action)才能找到outputFileName 变量
更多说明
插件迁移的更多说明相关文章推荐
- Android Studio 打包时动态修改aar 包名称
- Android studio修改源码之后打包成jar包
- Android Studio 批量打包,apk重命名
- android studio 在release打包时修改AndroidManifest.xml
- Android Studio修改apk命名
- Android Studio 多渠道打包自命名
- Android studio 打包apk如何重命名apk名称
- android studio 修改打包包名的正确方式
- Android Studio Gradle 多渠道自动打包,动态修改HostUrl,签名apk,混淆配置详解
- Android studio 设置之修改背景颜色为护眼色
- 利用javassist修改类的字节码并自动重新打包
- Android Studio中commit时的用户名修改
- webpack打包后css命名冲突问题
- cocos2d-x-3.12 打包android apk时 怎么修改已经配置好的setup.py参数 和解决 XX不是一个有效的 Android 目标平台 错误
- 批处理调用VBS脚本,一键打包时修改app名称
- apk安装包反编译+修改代码+替换资源+重新打包+签名全流程记录
- Android Studio 3.0 修改包名
- ASP.NET修改FCKeditor中asp.net上传文件时的命名
- PowerDesigner 的修改外键命名规则
- android studio 之修改包名导致所有R文件报错的解决办法(简单、暴力)