'gradle Unexpected lock protocol found in lock file. Expected 3, found 0
getting "Unexpected lock protocol found in lock file. Expected 3, found 0" error when trying to debug even after following this link and deleting the .gradle folder current gradle version is 4.4 and android studio 3.1.2
Solution 1:[1]
I found another solution which i think is much better.
- Go to project structure Ctrl + Alt + Shift + S and select Project from left menu if it is not already selected.
- Select latest Android Gradle Plugin Version
- Select Gradle Version to the latest stable one.
- Select Apply.
- List item
P.S It is better to Update gradle to latest stable version. Hope this helps
Solution 2:[2]
This error normally occurs when your system mistakenly shut down and the project is building. Here is the solution:
close the project
delete the project from Android Studio list
Close Android Studio
delete the .gradle folder from the root of your project
Run Android Studio again
Open existing Android Studio project
Or check here
Solution 3:[3]
Simplest & most easy way to solve this issue
This error generally occurs when we update our android studio version or make changes in previous projects. I don't know why but it comes randomly. I follow many ways to solve this but ill figure out the easiest way to tackle this.
- First, go to the android studio, then click on File.
- Second, go to the project structure & Click the project tab.
- Third, most imp step -> check the (Gradle Version) of yours (In my case my previous is 6.5 & latest one is 6.8.1) if it is the previous one, not the latest, then select the latest one..... remember not to select (beta) select only stable release. & (Apply) then (OK) -> your project start downloading files & I hope your problem gets solved. Just like mine. Check Images for better understanding.
Solution 4:[4]
Main Solution : The most effective solution in my case was change distributionUrl
(go to gradle-wrapper.properties
) to latest version like below.
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
Second Solution : invalid cache and restart.
Third Solution : Clean Project Rebuild Project.
Solution 5:[5]
To solve this issue it took me few steps:
-go to C:\Users[username] and delete the .gradle folder
-go to the project folder and delete the .gradle folder
-inside the project folder execute gradlew.bat
Solution 6:[6]
Don't use different Gradle versions for building a project!
Make sure that gradlew build
and gradle build
use the same version.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | zAmAr |
Solution 2 | Community |
Solution 3 | Tomer Shetah |
Solution 4 | Bhavin Solanki |
Solution 5 | |
Solution 6 |