6

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??

Zoe
  • 27,060
  • 21
  • 118
  • 148
mungaih pk
  • 1,809
  • 8
  • 31
  • 57
  • See http://stackoverflow.com/questions/23196254/how-to-start-develop-application-for-fire-os-in-android-studio-ide – Scott Barta Dec 15 '14 at 18:07
  • Does this answer your question? [Error:Unexpected lock protocol found in lock file. Expected 3, found 0](https://stackoverflow.com/questions/31743942/errorunexpected-lock-protocol-found-in-lock-file-expected-3-found-0) – Athafoud Dec 08 '19 at 19:40

7 Answers7

22

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

Erase it and restart your IDE.

1020rpz
  • 914
  • 10
  • 21
  • 1
    Worked for me! nice and easy :) – Lettings Mall Sep 13 '15 at 18:25
  • 3
    For me, I delete `~/.gradle/caches/2.8/`, then it works. (2.8 is gradle version that used in the project). In my situation, it's a fresh project without a ".gradle" folder in project root directory, so you may delete project-level ".gradle" folder as well. – Weekend Feb 18 '16 at 05:45
5

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.

Lalit Rane
  • 850
  • 10
  • 16
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.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Vipul jain
  • 129
  • 6
1

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

1

I've tried several solution:

  • First Solution: Go to File -> Invalid Caches, Restart.
  • Second Solution: First, Build -> Clean Project and then Build -> Rebuild Project
  • Third Solution: First, close the project and remove from workspace of Android Studio, then go to C:\Users\user\.gradle then delete .gradle folder. After that, open the project again.

But none of these worked. Then I found a solution. In my case, the problem was with the Gradle version. Check your Gradle version in File -> Project Structure (Ctrl+Alt+Shift+S) and the Plugin version as well:

In my case, the problem was in gradle version. Check your Gradle version File -> Project Structure(Ctrl+Alt+Shift+S) and Plugin version also.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
0

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

Muhammad Yawar
  • 424
  • 1
  • 3
  • 19
-1

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

andrey
  • 179
  • 1
  • 6