Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 'Clean Project' is not working

What I have done:

I have copied the same project('myProject') folder(which has no issues with clean/rebuild) to a new location keeping the previous folder as a backup and aiming to change the copied project to modify more. *Here the name of the project is the same only the location is different.

Then I opened my project in the new location and started to execute.

Observations:

No issues when I opened android studios initially and importing the project, and even the emulator is working. But when I tried to clean the project it says below error.

    Unable to delete directory 'C:\Users\sach\Desktop\Project02\test2\backup20191126\myProject\app\build'
  Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
  - C:\Users\sach\Desktop\Project02\test2\backup20191126\myProject\app\build\outputs\apk\debug
  - C:\Users\sach\Desktop\Project02\test2\backup20191126\myProject\app\build\outputs\apk
  - C:\Users\sach\Desktop\Project02\test2\backup20191126\myProject\app\build\outputs

Then I found this and tried with

Gradle > MyProject > app > Tasks > build > clean –

But still I received the same output as mentioned below

> Task :app:clean FAILED

    FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':app:clean'.
        >Unable to delete directory 'C:\Users\sach\Desktop\Project02\test2\backup20191126\myProject\app\build'
          Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
          - C:\Users\sach\Desktop\Project02\test2\backup20191126\myProject\app\build\outputs\apk\debug
          - C:\Users\sach\Desktop\Project02\test2\backup20191126\myProject\app\build\outputs\apk
          - C:\Users\sach\Desktop\Project02\test2\backup20191126\myProject\app\build\outputs

Error is the same as when I try to rebuild without clean.

Emulator is also working here, but unable to clean and rebuild. It is the same project with same name but in different locations. I was wondering why this happens here. Because there were no issues before I copied this here. Any clue to get rid of this please.

like image 898
Sachz Avatar asked May 19 '26 15:05

Sachz


1 Answers

close project and delete the folder app\build\intermediates manually

like image 160
codeocity Avatar answered May 22 '26 03:05

codeocity



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!