I have been facing these "Could not delete path" problems for months.
To run my application, I always have to delete all my app/build files. But it is very time-consuming.
Sometimes i have to restart android studio for run my application.
Tried clean project and run. Tried clean project, build project and run. tried Invalidates caches / restart also but my app didn't run until i clear that project build folder.
These are the errors I am getting alternatively.
Can I reinstall Android Studio to solve this or is there a solution to get rid of it?
Most easy way to get unlock file.
Download LOCKHUNTER and install in your system.
Close your android studio and select your Android studio from your system drive.
Select your folder, so you will get which all files is locked like image below.
Select all and Unlock BUTTON in application.
It will restart your application and have fun with android studio.
You cannot delete a file or folder because it is locked by another program.
First You should check out what program is causing the problem. On superuser.com there is already related topic and there is also a solution with step to step how to do it.
I used to use Process Explorer to resolve the problem.
you may not have permission to use the folder project try one of this solutions (maybe because of some antivirus apps or OS permissions):
copy project file to another place that you are sure to have read/write permission and open that new project folder in android studio
run android studio as administrator
right click on project folder and get read and write permissions to your username.