Error on Build Android Project

Using Gradle 4.4 build Project;
Got Error:
Could not set unknown property ‘outputFileName’ for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.

Anything I do wrong

applicationVariants.all { varient ->
varient.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith(".apk")) {
def apkName
if (varient.buildType.name.equals(“release”)) {
apkName = “${appName}${defaultConfig.versionName}${releaseTime()}${varient.productFlavors[0].name}.apk"
} else if (varient.buildType.name.equals(“debug”)) {
apkName = "${appName}
${defaultConfig.versionName}_debug.apk”
}
def sourceFile = “-${varient.flavorName}-${varient.buildType.name}”
outputFileName = output.outputFile.name.replace(sourceFile,apkName)
}

    }
}

Problem Solved,
Use output.outputfileName instead outputFileName only,

1 Like