Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle project refresh failed: Already finished

Background: I've been fighting with Studio/Gradle for a day or so at this point; there were initially multiple PEBKAC errors (namely permissions and resource limits) that have since been resolved. Unfortunately the google-fu has failed me for this current error.

The error specifically occurred attempting to complete ./gradlew clean which did not complete successfully; it failed about 30s in.

I temporarily 'fixed' the problem by blowing away the offending git repo and cloning it anew. I discovered the error seems to occur only on a specific branch (ie, switch to x_branch, run 'clean project,' receive error), but have not yet figured out why. Attempting to switch to another branch or back to master after receiving the error does not revert gradle back to a working state; the error remains.

Error: Gradle project refresh failed: Error: Already finished

System env: Android Studio 3.1 // Gradle version 171.4250

My question(s): Has anyone seen this error before? What does this error mean and how do I prevent it from re-occurring?

like image 225
specialk Avatar asked Dec 01 '17 19:12

specialk


Video Answer


2 Answers

Restarting Android studio :

File > Invalidate Caches/Restart worked for me

like image 122
Oush Avatar answered Oct 19 '22 23:10

Oush


This is what happen with me.

One of the folder (build folder) can't be access. I can't even open it using Windows Explorer. It looks like the folder has been corrupted.

I did the following:

  1. Clean the project: Build | Clean Project
  2. You will see problematic folder
  3. Close Android Studio
  4. Delete the folder
  5. Rebuild again

Good luck! I hope this solution help someone.


UPDATE

After deleting the folder, you may want to Invalidate Caches / Restart... I just hit on the same problem again. Deleting folder without Invalidate Caches / Restart... doesn't work :(

like image 22
Sam Avatar answered Oct 20 '22 00:10

Sam