'Gradle UncheckedIOException

My Android Studio project worked correctly, after restart project i got this error :

Caused by: org.gradle.api.UncheckedIOException: Failed to create directory 'C:\Users\Win\ .gradle\caches\transforms-2\files-2.1\32579628dbe4361d42479786c21faaed'

I did these things and the problem is not resolved:

  1. Invalidate caches / restart

  2. Clean / Rebuild

Extra info:

Android studio version: 3.4.1

compileSdkVersion: 29
minSdkVersion 21
targetSdkVersion 29

Anyone can resolve this problem ?



Solution 1:[1]

Go to path C:\Users\Win\ .gradle\caches and manually delete this directory. Note that .gradle is a hidden folder.

Solution 2:[2]

I've tried the solution removing the .gradle/caches folder, but it not worked.
I've tried the solution Invalidates caches / restart -> rebuild, but it not worked too.
I solved this updating my gradle version to gradle-6.3 at gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip

This gradle version requires Android gradle plugin at least 3.6.0:

buildscript {
   dependencies {
        classpath "com.android.tools.build:gradle:$gradle_version"
   }
}

Solution 3:[3]

In my case, nothing of the above suggested fixes worked. Eventually, it was a folder permissions setting on Windows' side.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 shizhen
Solution 2 heronsanches
Solution 3 Mor Sagmon