I have created a Flutter app using Visual Studio code. When I checked with the Flutter doctor, there was no problem. But after selecting the device and launching the Pixel 2 API 33, when I run my main. dart file, it gives an error.
Launching libmain.dart on sdk gphone64 x86 64 in debug mode…
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: C:UsersDinu.gradlewrapperdistsgradle-7.6.3-allaocdy2d2z8kodnny3rsumj8i8gradle-7.6.3-all.zip
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task ‘assembleDebug’… 121.0s
[!] Gradle threw an error while downloading artifacts from the network.
Retrying Gradle Build: #1, wait time: 100ms
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: C:UsersDinu.gradlewrapperdistsgradle-7.6.3-allaocdy2d2z8kodnny3rsumj8i8gradle-7.6.3-all.zip
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task ‘assembleDebug’… 120.5s
[!] Gradle threw an error while downloading artifacts from the network.
Error: Gradle task assembleDebug failed with exit code 1
2
Answers
Delete
./gradle
folder from your project folder and run your application.Delete Gradle Cache: Sometimes the Gradle cache can get corrupted, causing issues like this. Deleting the cache will force Gradle to download a fresh copy of everything it needs:
Navigate to the .gradle folder in your user directory (C:UsersDinu.gradle).
Delete the wrapper folder or the specific version folder that is causing the problem (gradle-7.6.3-all).