Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in building project in Android Studio

Freshly Installed Android Studio and started new android project. When tried to run it. Got this error from Gradle

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

I have tried to rebuild the project and also tried to delete .gradle folder but nothing worked.

like image 594
shikhar bansal Avatar asked Jun 10 '15 06:06

shikhar bansal


People also ask

What is Gradle error in Android Studio?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again.


1 Answers

I'm having the same problem and deleting just the cache.properties.lock is not enough.

The solution, as pointed before, is deleting the cache.properties.lock file, but not only in the folder pointed by Android Studio. I needed to remove every lock file inside .gradle\caches\VERSION.

So, I created a small .bat file with this:

del /s cache.properties.lock 

Add this file to .gradle\caches\VERSION\ and run it. My Android Studio stopped complaining afterwards.

Hope it helps!

like image 76
Sagito Avatar answered Sep 24 '22 12:09

Sagito