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.
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:
Add this file to .gradle\caches\VERSION\ and run it. My Android Studio stopped complaining afterwards.
Hope it helps!