ProcessException: Process "C:\Users\User\Desktop\Courses\flutter\myapp\android\gradlew.bat" exited abnormally:
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: C:\Users\User\.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv\gradle-4.10.2-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)
Command: C:\Users\User\Desktop\Courses\flutter\myapp\android\gradlew.bat -v
When i run my flutter app from vs code it shows this error, what is wrong here?
Here are the steps that I followed to solve the problem.
run flutter run
on the command prompt given by your OS(not by the vs code shell).
make sure you have a good internet connection.
For me, the problem was that my internet connection could not download the Gradle binaries while initializing Gradle. I suspect it's because I'm behind a proxy.
Try downloading it and installing it manually.
- Download the latest Gradle version.
- Extract the ZIP file to a location on your PC, i.e C:\Gradle
- add the environment variable
GRADLE_HOME
to point to this location.
- add
GRADLE_HOME/bin
to your PATH
environment variable.
This might help if you have license problem.
- run
flutter doctor
on command prompt. If you get this:
! Some Android licenses not accepted.
- run
flutter doctor --android-licenses
and accept all the licenses.
- now run
flutter run
and you are good to go.
The problem is with your gradle installation, for linux users:
- Navigate to
.gradle
folder in your Home directory
- Open
wrapper/dists
and you'd find all your gradle installation
- If you find just one delete it and re-run your dart code from vs-code
- Ensure you have a good internet as the process would try to download a new gradle.
- In case you have more than one gradle installed go back to vs-code and take note of what version of gradle it is complaining about.
- Delete that version and re-run your dart code (don't forget to get a good internet).
Delete .gradle
the folder in C:\Users***.gradle
in Windows or /Users/xxxx/.gradle
in Mac , connect to the internet, rebuild project to download the latest Gradle.
Open gradlew.bat file in edit mode in the new window of android studio and resolve the gradle issue.
I Just delete gradle-4.10.2-all and rebuild my project.
I solve this error with delete flutter sdk and download it again. Be sure that you have good internet.
defaultConfig {
// TODO: Specify your own unique Application ID
(https://developer.android.com/studio/build/application-id.html).
applicationId "com.match_hire"
minSdkVersion 16
targetSdkVersion 28
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
add multiDexEnabled true might work
I have solved this issue by setup android project in android studio and android studio shows me error that your kotlin version is not compatible so i upgrade kotlin version.
ext.kotlin_version: '1.2.71' -> '1.3.50'
It started working fine.