编译Flutter项目时发生Gradle错误

时间:2020-04-29 00:56:15

标签: flutter gradle

我正在尝试运行Flutter应用程序,但是它出现以下gradle错误,有人可以帮助我吗?我尝试了一些堆栈自己的解决方案,但n解决了。

我的代码build.grade是:

buildscript {
    repositories {
        google()
        jcenter()

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.google.gms:google-services:4.3.3'
    }

}

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
}

此错误是: Message error

更新

我已经解决了上述错误,但是现在却遇到了这样的错误,

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using 
BuildScopeServices.createScriptPluginFactory().
> Could not create service of type FileHasher using 
BuildSessionScopeServices.createFileSnapshotter().

* 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

 BUILD FAILED in 6s
 Gradle task assembleDebug failed with exit code 1

1 个答案:

答案 0 :(得分:0)

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().

* 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

BUILD FAILED in 6s
Gradle task assembleDebug failed with exit code 1