IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    新版本Gradle修改打包的路径和文件名

    LengYue\'s Blog发表于 2018-09-08 17:16:07
    love 0
    这里分为Gradle3.0之前和之后两种方法。 3.0之前 在release 下添加下面代码 applicationVariants.all { variant -> variant.outputs.each { output -> if (outputFile != null && outputFile.name.endsWith('.apk')) { def apkFile = new File( output.outputFile.getParent(), "${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk") output.outputFile = apkFile } } } 3.0之后 3.0之后不允许修改 output.outputFile 会提示报错。 applicationVariants.all { variant -> variant.outputs.all { output -> def outputFile = output.outputFile if (outputFile != null && outputFile.name.endsWith('.apk')) { def fileName = "${defaultConfig.


沪ICP备19023445号-2号
友情链接