Android studio unexpected lock file protocol

2019-05-02 15:24发布

问题:

Am trying to import an android studio project into a new machine. The import goes on fine and the directories of the project are displayed correctly.However, when i try to build or clean the project, android studio raises the following error

Gradle 'ngoma' project refresh failed
Error:Unexpected lock protocol found in lock file. Expected 3, found 0.

I have tried closing and reopening the project, changing the permissions of the folder containing the projects but nothing is changing. How can I solve this error??

回答1:

Go into your local file project and search for the ".gradle" folder

Erase it and restart your IDE.



回答2:

Removing the contents from .gradle folder in home folder and restarting Android Studio resolved the issue. Please note I earlier removed the contents from .gradle folder from Android Project folder, but this did not help.



回答3:

I had this problem and deleting the project's .gradle folder didn't fix the problem.

I solved the problem by deleting the C:\Users\<username>\.gradle folder and restarting my IDE.



回答4:

The SDK library is no specified, try to set it on configuration



回答5:

i fixed my issue by invalidating caches, go to file -> invalidate caches / restart



回答6:

It is also enough to delete only all *.lock files in ~/.gradle folder