8

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)

2

4 Answers 4

13

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

3

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.

2

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

1
  • I'm using Android studio 3.1.3 and gradle 4.4 and this is what worked for me.
    – Barzee
    Jun 13, 2018 at 22:25
1

You could try to delete this : C:\Users_USER_.gradle\caches_GRADLE_\scripts_XXX_\InitScript\initscript\cache.properties.lock

I had the same problem and after deleting it all works fine.

Another common problem with Gradle is synchronization which is solved adding the correct path of JDK but this is another story.

I hope to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.