Search code examples
androidprojectandroid-studio-2.0rebuild

Unable to clean or rebuild project in Android Studio 2


I have a problem with my Android studio 2. That's whenever I want to clean or rebuild my android project, I always get this message

Error:Execution failed for task ':app:clean'. Unable to delete directory: C:\Users\MyPC\Desktop\SharePlace\app\build\intermediates enter image description here

and can not fix it. what I only can do is go to File explorer and delete it. then come back android studio and rebuild again. Sometime, that way also does not work. I need some help to fix that Android studio. Please. Thank inadvance!


Solution

  • Solution 1 :

    you are using Android Studio 2.0 Beta, this issue might appear (more likely if you are working on NTFS filesystem) and it seems like the "Instant Run" is the culprit. Search for "Instant Run" in settings and uncheck the box.

    I have filed an issue on the bug tracker.

    Solution 2 :

    You need to go to the source file directly. Close the studio and go to the path the issue is located at and delete the folder there.