in android ~ read.

Modifying variant outputs at build time may not work with new Gradle 4.x

If you have upgraded to new Android Studio 3.0 than this could happen to you as new Gradle 4.x have some changes in 'outputFile'

You will get message like this

Error:(120, 0) Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated
{apkData=Main{type=MAIN, fullName=releaseDebug, filters=[]}} of type

This is example in gradle script

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

after change old each with all should work :)