Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I updated my android studio into 2.3 then upon connecting my app to Firebase, it gave me an error:

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

Do I need to go back to 2.2.3 or is there any way to fix this? I tried deleting .gradle file in my project but it still gave me an error.

like image 320
lala Avatar asked Mar 24 '17 23:03

lala


2 Answers

Delete the .gradle folder from user directory, not from the project.

C:\users\username\.gradle in windows
/home/username/.gradle in Linux 
/users/username/.gradle in Mac
like image 106
Gabriele Mariotti Avatar answered Nov 12 '22 03:11

Gabriele Mariotti


Before you go deleting your entire general .gradle folder for android studio, please note the following implications and consequences.

  • It will cost as much as 3 -4 GB to re-download its content
  • The download could take days if you are not careful and the network is not super fast
  • For every old project you reopen, chances are some items are missing, therefore, the android studio will have to redownload missing content, god help you if you chose to take out your laptop at a random eatery without free internet and quickly get some work done.
  • The deletion process involves thousands of file, up to 119k, the operating system finding them will take forever and deletion will take even longer.

Here is a much better solution;

  • Close android studio completely
  • Using the file explorer of the operating system, in your app's project folder open the .gradle folder
  • Note the number(name) of the folder in it, such as (2.3 or 4.4 or 4.6 or 4.8)
  • Go to your general .gradle folder as described by @Gabriele Mariotti
  • open it and open the "caches" folder
  • Delete the folder with the same number as the second step
  • If you are paranoid like me you could also delete your project's .gradle file too (not necessary)

The file is not larger than 4 MB and it will not be re-downloaded but regenerated by android studio automatically, therefore the whole process should not take you 5 mins, costs no data, and all previous projects function as normal.

like image 31
EAM Avatar answered Nov 12 '22 04:11

EAM