Error: Execution failed for task ':app:clean'. Unable to delete file

后端 未结 30 1177
感动是毒
感动是毒 2020-11-29 17:19

I\'m trying to rebuild my Android Studio Gradle project (containing mostly Kotlin code), but it started to throw an UnableToDeleteFileException during the clean

相关标签:
30条回答
  • 2020-11-29 17:59

    I killed all the java TM processes in the task manager and it let me to rebuild

    0 讨论(0)
  • 2020-11-29 17:59

    Clean project from Terminal using this command gradlew clean.

    0 讨论(0)
  • 2020-11-29 17:59

    I just solved this exact problem for myself.

    The problem was that somebody else had created the file so even though I have admin rights on the computer I was unable to make changes to the file or files. You need to go into the properties of the file or folder and change the ownership or add ownership. This web page explains it well step by step what you need to do.

    Once I did the above, I found the file in file explorer and manually extracted it. I don't think it's needed in the android studio project if it was trying to delete it anyway.

    0 讨论(0)
  • In Android Studio 3.0, I had the same issue. This fixed it:

    1. Close Studio
    2. Delete projectRoot/build/ and projectRoot/app/build/
    3. Restart Studio
    0 讨论(0)
  • 2020-11-29 18:04

    I solved with command:

    taskkill /F /IM java.exe
    

    and then:

    gradle assembleDebug 
    
    0 讨论(0)
  • 2020-11-29 18:04

    The solution is quite easy.

    This is one of the solution which worked for me.

    It might be possible that your project's app/build/outputs/apk folder is opened.

    so just close this folder and rebuild your project. and it will be solved.

    0 讨论(0)
提交回复
热议问题