0

I often get stuck when run gradle build task in android studio. If I force stopping the android studio and restart it, then run again, there will be an error that some .lock files are occupied, which are really hard to delete them one by one manually.

I have tried to delete .gradle folder in project and ~/.gralde/caches folder and the error was solved, however it took a lot of time to re-download some cached files. So which folders should be deleted in my situation after all? Thanks for any comment!

Yuki N
  • 157
  • 8

1 Answers1

0

It is not stuck, it will take some time normally 5-7 mins, it also depends upon internet connection, so wait for some time. It will take time only for the first launch.

Update: Check the latest log file in your C:\Users\<User>\.gradle\daemon\x.y folder to see what it's downloading.

Fixed it by going to Android Studio -> Preferences -> Gradle -> and ticking Offline work. Still have no idea what was wrong, but at least now it compiles.

Edit: In new Android Studio Versions the path is File -> Other Settings -> Default Settings -> Build-Excecution-Deployment -> Gradle

Enable Offline Work from Setting :

enter image description here

S_i_l_e_n_t C_o_d_e_r
  • 2,179
  • 2
  • 7
  • 21