android studio gradle refresh failed (The system cannot find the file specified)

UPDATE: Check my answer here for full details

I have the latest version of Android Studio and I faced that problem, the only thing that worked for me is to:

1-Navigate to C:\Users\user.gradle\caches\2.4\

2-Copy the folder "scripts" and paste it somewhere safe just in case anything went wrong you will place it back

3-Delete this folder "scripts" from the directory C:\Users\user.gradle\caches\2.4\

4- Sync Project with Gradle Files and you are done.

When you sync your project Android Studio will generate new cash files.

It worked for me I hope it will work for you...


I don't know why a great developer as Google can't manage this issue by them selves it is very easy to delete the cached folder and regenerate it programmatically. Any way just navigate to C:\Users\user.gradle\caches\ and open the latest version folder, then delete the scripts folder. Go to android studio and sync project, that should do it.


Exit Android Studio, remove the Gradle cache folder which path is in the error message, and restart.

Tags:

Android