Android Studio. Gradle Sync error: Could not move temporary workspace

  Kiến thức lập trình

I am making a new project in Android Studio, but I have a problem when it is syncing gradle for the first time and I can’t do anymore.

I get these error messages:

FAILURE: Build failed with an exception.

* What went wrong:
java.io.UncheckedIOException: Could not move temporary workspace (C:UsersACERAndroidStudioProjectsCamaraX.gradle8.6dependencies-accessorsdcbcd87108cec70bb467e05d5172bee8efb944af-0241f059-0743-498d-b994-7c82e3b551d2) to immutable location (C:UsersACERAndroidStudioProjectsCamaraX.gradle8.6dependencies-accessorsdcbcd87108cec70bb467e05d5172bee8efb944af)
> Could not move temporary workspace (C:UsersACERAndroidStudioProjectsCamaraX.gradle8.6dependencies-accessorsdcbcd87108cec70bb467e05d5172bee8efb944af-0241f059-0743-498d-b994-7c82e3b551d2) to immutable location (C:UsersACERAndroidStudioProjectsCamaraX.gradle8.6dependencies-accessorsdcbcd87108cec70bb467e05d5172bee8efb944af)
...
* Exception is:
java.lang.RuntimeException: java.io.UncheckedIOException: Could not move temporary workspace (C:UsersACERAndroidStudioProjectsCamaraX.gradle8.6dependencies-accessorsdcbcd87108cec70bb467e05d5172bee8efb944af-0241f059-0743-498d-b994-7c82e3b551d2) to immutable location (C:UsersACERAndroidStudioProjectsCamaraX.gradle8.6dependencies-accessorsdcbcd87108cec70bb467e05d5172bee8efb944af)
...
Caused by: java.io.UncheckedIOException: Could not move temporary workspace
...
Caused by: java.nio.file.AccessDeniedException

I tried switching to a newer version, but the same thing happens and with older versions I get this:

Minimum supported Gradle version is 8.6. Current version is 8.5.

Please fix the project's Gradle settings.
Change Gradle version in Gradle wrapper to 8.6 and re-import project
Open Gradle wrapper properties
Gradle Settings.

New contributor

Ulises Cortés is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT