After upgrading Android Studio to 1.3, I can\'t compile my project anymore. I am getting Unexpected lock protocol found in lock file. Expected 3, found 0.
. I ha
okay here's very lightweight solution with steps:
Ctrl+Alt+Shift+S or File->Project Structure
Select Project from left panel
Now check your Gradle Version at right panel
In my case my Gradle Version is 3.3
Navigate C:\Users\ashish\.gradle\caches and delete your Gradle Version - 3.3 named folder.
Now restart or open your project again from workspace.
Greetings...your problem is solved.
In my case, GRADLE_USER_HOME was not set due to a machine change. After re-setting this env variable, everything works fine again.
Delete C:\Users\user\.gradle\caches folder and restart the project.
All of these solutions did not work for me on Android Studio 2.1. What worked was me opening gradle-wrapper.properties in project folder and changing my gradle reference on the line below:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
This was changed to:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
After which gradle upgraded and the app started working!
Open your previous project and open file>ProjectStructure>project check this gradle version,android plugin version of previous project and set it to your current project .and click invalidate/restart
Deleting cache folder take long time because it have more than 200k files which is more than 3GB. There is quick view as Ashish mentioned.
I also faced this error in only one app.
Go through the step.
In you project open gradle-wrapper.properties
file. Which is located in Gradle Script in Android structure. As shown in below image.
In that file check distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
. Here gradle version is 4.6.
3.So all cache for that project will be store in your C:\Users\Your PC Name or User Name\.gradle\caches\4.6
. As shown in below image.
That's all. It took mine 6 hours to figure out and deleting cache folder. So I decide to post this answer. So people will not waste same time.