Error:Unexpected lock protocol found in lock file. Expected 3, found 0

前端 未结 28 1519
灰色年华
灰色年华 2020-12-01 01:18

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

相关标签:
28条回答
  • 2020-12-01 01:32

    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.

    0 讨论(0)
  • 2020-12-01 01:34

    In my case, GRADLE_USER_HOME was not set due to a machine change. After re-setting this env variable, everything works fine again.

    0 讨论(0)
  • 2020-12-01 01:36
    Delete C:\Users\user\.gradle\caches folder and restart the project.
    
    0 讨论(0)
  • 2020-12-01 01:37

    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!

    0 讨论(0)
  • 2020-12-01 01:37

    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

    0 讨论(0)
  • 2020-12-01 01:38

    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.

    1. In you project open gradle-wrapper.properties file. Which is located in Gradle Script in Android structure. As shown in below image.

    2. 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.

    1. Close your android studio and delete the 4.6 folder. After deletion open android studio.

    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.

    0 讨论(0)
提交回复
热议问题