I had same issue. I have tried many things but nothing worked Until I try following:
- Close Android Studio
- Delete any directory matching
gradle-[version]-allwithinC:\Users\<username>\.gradle\wrapper\dists\. If you encounter a “File in use” error (or similar), terminate any running Java executables. - Open Android Studio as Administrator.
- Try to sync project files.
- If the above does not work, try restarting your computer and/or delete the project’s
.gradledirectory. - Open the problem project and trigger a Gradle sync.