I am trying to use the Android build tools "com.android.tools.build: gradle: 3.0.0-alpha4" in my project. In my build script, I will rename the apk output, which worked fine in the past, but seems to be no longer supported.
applicationVariants.all { variant -> def filename = "foo-${variant.baseName}-${variant.versionName}-(${android.defaultConfig.versionCode}).apk" variant.outputs.all { output -> output.outputFile = new File( output.outputFile.parent, filename ) } }
Now the property I'm trying to change has become unchanged:
Error: cannot set read-only 'outputFile' property value for ApkVariantOutputImpl_Decorated {apkData = Main {type = MAIN, fullName = stageDebug, filters = []}} of type com.android.build.gradle.internal. api.ApkVariantOutputImpl.
Is there a new or alternative way to do this?
source share