Skip to content

Instantly share code, notes, and snippets.

View tunjos's full-sized avatar

Tunji Olu-Taiwo tunjos

View GitHub Profile
@tunjos
tunjos / copyReleaseApkToCustomDir.gradle
Last active December 8, 2021 03:10
Copy release apk to custom directory
def publish = project.tasks.create("copyReleaseApkToCustomDir")
publish.description "Copies release apk to custom directory"
android.applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.outputs.each { output ->
if ( output.outputFile != null && output.outputFile.name.endsWith('.apk')) {
def task = project.tasks.create("copyAndRename${variant.name}Apk", Copy)
def outputFile = output.outputFile
println "Creating " + rootProject.name + "-${versionName}.apk" + " from " + project.name + "-${variant.name}.apk"