Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

Error:Could not open initscript class cache for initialization script 'C:\Users\Subash\AppData\Local\Temp\asLocalRepo2.gradle' (C:\Users\Subash.gradle\caches\2.2.1\scripts\asLocalRepo2_cd0g6mnzdabuvxgeqlhhrxv0q\InitScript\initscript). java.io.FileNotFoundException: C:\Users\Subash.gradle\caches\2.2.1\scripts\asLocalRepo2_cd0g6mnzdabuvxgeqlhhrxv0q\InitScript\initscript\cache.properties (The system cannot find the file specified)

like image 626
subash s Avatar asked Aug 20 '15 14:08

subash s


3 Answers

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...

like image 142
Salam El-Banna Avatar answered Nov 14 '22 03:11

Salam El-Banna


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.

like image 44
itxdev Avatar answered Nov 14 '22 02:11

itxdev


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

like image 2
Warabei Avatar answered Nov 14 '22 02:11

Warabei