如何解决“无法找到或加载主类org.gradle.launcher.daemon.bootstrap.GradleDaemon”的问题?

时间:2019-08-11 20:39:13

标签: gradle flutter gradlew

我已经安装了新PC,并且Flutter出现了一些问题。以前在我的旧PC上运行良好。 我已经安装了Android Studio,Android SDK,Flutter,带有Dart和Flutter插件的VS Code,然后创建了新的flutter项目。将手机连接到PC并按F5后,出现此错误:

* Error running Gradle:
ProcessException: Process "D:\FlutterProjects\quotes\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)


FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.10.2/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error: Could not find or load main class org.gradle.launcher.daemon.bootstrap.GradleDaemon


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
  Command: D:\FlutterProjects\quotes\android\gradlew.bat app:properties

Please review your Gradle project setup in the android/ folder.

扑打医生看起来还不错。 这是我的gradle-wrapper.properties:

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

和gradle.properties:

org.gradle.jvmargs=-Xmx1536M
org.gradle.daemon=true
org.gradle.parallel=true

最后一件事,build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

有人可以帮助我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

运行

flutter clean

它将清除您当前的构建文件夹和缓存,然后在您运行Flutter App时,将创建一个新的构建文件夹。

在大多数情况下会对其进行修复。