shikhar bansal shikhar bansal - 1 year ago 102
Android Question

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). C:\Users\Dexter\.gradle\caches\2.2.1\scripts\asLocalRepo10_d10e66d3o7exs19wwq4uj2zhv\InitScript\initscript\ (The system cannot find the file specified)

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

Answer Source

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

The solution, as pointed before, is deleting the 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

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

Hope it helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download