Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio I keep getting Gradle error "The process cannot access the file because it is being used by another process"

I can import a sample app project, try to build it and I keep getting this error. Not always the same file but a new temp file each time. I've tried several different samples. I've been programming for 30+ years and feel completely clueless. Only clue seems to be the Windows Task Manager shows 99% to 100% CPU usage when it gives the error and ends the build.

like image 720
Bruce E Avatar asked Jan 08 '17 21:01

Bruce E


4 Answers

Do This

File -> Invalidate Caches / Restart.. -> Invalidate/ Restart

like image 59
saigopi.me Avatar answered Oct 13 '22 20:10

saigopi.me


When this happens to me on Windows 8, I open the task manager

task manager

and simply kill all the instances of "openjdk platform binary"

like image 25
gianpaolo Avatar answered Oct 13 '22 22:10

gianpaolo


Just clean the project and have a run ! It would work ....

like image 9
shayekh Avatar answered Oct 13 '22 21:10

shayekh


enter image description here

Choose app instead of DefaultPreview. Now if you build, then you should not see this issue.

like image 8
Ryan Chen Avatar answered Oct 13 '22 20:10

Ryan Chen