Skip to content

Instantly share code, notes, and snippets.

@aballano
Last active January 30, 2018 13:06
Show Gist options
  • Save aballano/50385add9fbbe06c755e8cd7f5158784 to your computer and use it in GitHub Desktop.
Save aballano/50385add9fbbe06c755e8cd7f5158784 to your computer and use it in GitHub Desktop.
Trying to copy generated apk from build/outputs/apk/{variantname}/name.apk to build/outputs/apk/name.apk
def publish = project.tasks.create("copyApkToCustomDir")
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
def task = project.tasks.create("copy${variant.name}Apk", Copy)
task.from(output.outputFile)
task.into("$project.buildDir/outputs/apk/")
println "Done"
task.dependsOn variant.assemble
publish.dependsOn task
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment