ProcessException: Process “C:\..\myapp\android\gra

2020-02-13 08:15发布

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?

标签: dart flutter
9条回答
Fickle 薄情
2楼-- · 2020-02-13 08:33

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.

查看更多
疯言疯语
3楼-- · 2020-02-13 08:35

Here are the steps that I followed to solve the problem.

  1. run flutter run on the command prompt given by your OS(not by the vs code shell).

  2. make sure you have a good internet connection.

查看更多
在下西门庆
4楼-- · 2020-02-13 08:35
    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
5楼-- · 2020-02-13 08:40

This might help if you have license problem.

  1. run flutter doctor on command prompt. If you get this: ! Some Android licenses not accepted.
  2. run flutter doctor --android-licenses and accept all the licenses.
  3. now run flutter run and you are good to go.
查看更多
来,给爷笑一个
6楼-- · 2020-02-13 08:40

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.

查看更多
Emotional °昔
7楼-- · 2020-02-13 08:41

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.

  1. Download the latest Gradle version.
  2. Extract the ZIP file to a location on your PC, i.e C:\Gradle
  3. add the environment variable GRADLE_HOME to point to this location.
  4. add GRADLE_HOME/bin to your PATH environment variable.
查看更多
登录 后发表回答