How to fix Android Gradle 8.4 failed to clean

19 Views Asked by At

After upgrading from gradle 8.3 to 8.4, "gradlew clean" no longer works. If I change it back to 8.3 it works again. This is happening on Windows 10 and the error received is:

java.io.IOException: Unable to delete directory ...\app\build
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.

However this error is misleading. The actual problem appears to be gradle 8.4 failing to delete the "intermediates" directory because it is set as Read Only in the file system. Gradle 8.3 doesn't seem to care about the read-only flag on the directory, which is why it works.

I've tested this theory by doing a build and then clearing the read-only property of "intermediates" and all its children. After doing that, gradlew clean works properly.

Is there a fix for this or is there one coming in a newer version of gradle?

0

There are 0 best solutions below