Android Studio 2.x

applicationVariants.all { variant ->        variant.outputs.each { output ->                def outputFile = output.outputFile                if (outputFile != null && outputFile.name.endsWith('.apk')) {                    // 这里修改apk名称                    def fileName =  "hello_${defaultConfig.versionName}.apk"                    output.outputFile = new File(outputFile.parent, fileName)                }        }}

使用AS3时这样设置会遇到错误:Cannot set the value of read-only property ‘outputFile’

Android Studio 3

android.applicationVariants.all { variant ->    variant.outputs.all {        outputFileName = "hello_${defaultConfig.versionName}.apk"    }}

参考:https://stackoverflow.com/questions/44239235/android-gradle-3-0-0-alpha2-plugin-cannot-set-the-value-of-read-only-property

更多相关文章

  1. android 开发中遇到错误及解决办法总结(在别处看到的)
  2. Android 'showAsAction' in package 'android'错误解决
  3. Android Studio 提示错误:No IDEA annotations attached to the J
  4. Android 错误 'roundIcon' in package 'android'
  5. 错误:AGPBI: {“kind“:“error“,“text“:“Android resource c
  6. xarmain使用Forms编译android工程出现support_r19.0.1.zip支持包
  7. Android Studio 错误 Duplicate files copied in APK META-INF/L
  8. 升级android sdk时A folder failed to be renamed or moved 错误

随机推荐

  1. 数据探索很麻烦?推荐一款史上最强大的特征
  2. 给Python初学者的最好练手项目,进来看就对
  3. 长点心吧年轻人,利率不是这么算的!我用Pyth
  4. 说说开源那些事儿
  5. 5 种方法教你用Python玩转histogram直方
  6. Android(安卓)/ OPhone开发系列教程正在
  7. 公众号正义与黑产对抗史
  8. 如何通过 Tampermonkey 快速查找 JavaScr
  9. 当面试官要求现场手敲代码,该如何体现你对
  10. 2019 年终总结:新生活、新探索