Gradle project refresh failed: Already finished

限于喜欢 提交于 2020-01-11 04:59:05

问题


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?


回答1:


Restarting Android studio :

File > Invalidate Caches/Restart worked for me




回答2:


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 :(




回答3:


I had this problem in my Android Studio, I managed to solve it by going to the folder where the android studio is installed and deleting the folder gradle when you return to your project to recompile and it will do the download again. I do not know if it's the best solution, but it works!



来源:https://stackoverflow.com/questions/47600021/gradle-project-refresh-failed-already-finished

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!