Keep geting Error:Execution failed for task ':app:packageDebug'


(Shawn Li) #1

Today,I updated my gradle from 3.3 to 4.1 then I keep getting this:

Error:Execution failed for task ‘:app:packageDebug’.

Cannot create directory D:\eFresh for Android\app\build\outputs\apk\debug\D:\eFresh for Android\app\build\outputs\apk\debug

This is when I try to run with my device,I am using android studio 3.0 and I also tried gradle 4.3.1 but get the same error.
This seems some configure error since the directory is duplicated,but I don’t know how to fix this,any information or thoughts will be helpful,thanks!

(Shawn Li) #2

I got it ,this is because I used :

applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = new File(output.outputFile.parent,“app-release.apk”,
“efresh android” + versionName + “.apk”))

just delete the output.outputFile.parent,this is fixed,I think this is because gradle 4.x has set the parent dir as default,so you don’t have to set the parent dir again.