Created
July 30, 2024 20:44
-
-
Save pankajXdev/574063901ada2fafa329068f41ddb076 to your computer and use it in GitHub Desktop.
Config your output file name in Gradle Kotlin DSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.android.build.gradle.internal.api.BaseVariantOutputImpl | |
import java.text.SimpleDateFormat | |
import java.util.Date | |
android { | |
//... | |
applicationVariants.all { | |
outputs.all { output -> | |
if (output is BaseVariantOutputImpl) { | |
val date = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date()) | |
val filename = "AppName_${versionName}-${versionCode}_${date}_${name}.apk" | |
output.outputFileName = filename | |
} | |
true | |
} | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment