The code is as follows:

applicationVariants.all { variant ->
        variant.outputs.all {
            def buildType = variant.buildType.name
            def formatDate = new Date().format('yyyyMMdd')
            outputFileName = "gongzufang-${variant.versionName}-${versionCode}-${buildType}-${formatDate}.apk"
        }
    }
Copy the code