I had a script tat used to copy the apps from given output folder to a server. With update Of gradle 4.1, the script has broken because the Output path has changed. Now I am trying to write the gradle script to copy the build from new directory to older path and delete the generated one
applicationVariants.all { variant ->
variant.outputs.all {
//add here your logic to customize the name of the apk
outputFileName = "demoName-" + variant.buildType.name + ".apk"
}
variant.assemble.doLast { //assemble ->
//copy the apk in another directory, add here your
//logic to customize the destination folder
println "***********" + variant.outputs*.outputFile + "***************"
copy {
from variant.outputs*.outputFile
into "$project.buildDir/apk/"
}
//if you don't want to delete the file after copying it comment the line below
delete variant.outputs*.outputFile
}
}
When executing ./gradlewAssemble, it works fine for debug version but doesnt work for release. The error is mentioned below :-
Could not find method copy() for arguments [build_59frnzsit9pioe5hqxmxzw19v$_run_closure2$_closure7$_closure13$_closure15$_closure16@3fdf4ccd] on task ā:app:assembleReleaseā of type org.gradle.api.DefaultTask.
Where am i going wrong?