Apk rename with the Gradle plugin v4.10.1

Try this:

android.applicationVariants.all { variant ->
    variant.outputs.all { output ->
        def builtType = variant.buildType.name
        def versionName = variant.versionName
        def versionCode = variant.versionCode
        def flavor = variant.flavorName
        outputFileName = "app-${flavor}-${builtType}-${versionName}-${versionCode}.apk"
    }
}

This outputs the following apk name : app-release-myFlavor-0.0.1-1.apk.


You can do it like this:

defaultConfig {
    ...

    project.ext.set("archivesBaseName", applicationId + "_V" + versionName + "("+versionCode+")_" + new Date().format('dd-MM mm'));

}

Using setProperty method you can rename your .apk name.

You can do this.

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.expertBrains.abc"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 75
        versionName "2.6.15"
        multiDexEnabled true
        setProperty("archivesBaseName", "(" + versionName + ") "+ new Date().format( 'yyyy-MM-dd HH:mm' ))

    }
}