Dương Nguyễn Văn
Dương Nguyễn Văn

Reputation: 418

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!

Upvotes: 2

Views: 7429

Answers (5)

Shakedimus
Shakedimus

Reputation: 11

For me it was fixed by running Android Studio as administrator.

Upvotes: 1

kklmarvelmedia
kklmarvelmedia

Reputation: 61

Found the solution. For windows, goto Task Manager and find your Android Studio. Expand it and end task for OpenJDK Platform Binary as depicted below

screenshot.

Then re-run your app in Android Studio again. It should work, and you don't have to restart your Android Studio all the time. More productivity~

Upvotes: 0

CharchitJd
CharchitJd

Reputation: 13

Manually deleted folder( build\generated and build\intermediates) after closing android studio works for me.

Upvotes: 0

Szymon Gałązka
Szymon Gałązka

Reputation: 249

I got a lot of faults like this.

Try to refresh all gradle projects: in Android Studio click on the "Gradle" tab on the right side of the window. When the gradle menu is shown, click on two blue mixed arrows icon. Then wait a moment until gradle completes refreshing and try cleaning or rebuilding again.

Gradle refresh icon screen

Upvotes: 4

user5248371
user5248371

Reputation:

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.

Upvotes: 4

Related Questions