无法创建 org.gradle.invocation.DefaultGradle 类型的实例
问题描述:
我无法构建和运行我的颤振项目.每次我运行项目时,它都会给我这个错误
I'm unable to build and run my flutter project. Every time I run the project it gives me this error
FAILURE:构建失败,出现异常.
FAILURE: Build failed with an exception.
- 出了什么问题:无法创建 org.gradle.invocation.DefaultGradle 类型的实例.无法使用 GradleScopeCompileServices.configure() 配置服务.
我搜索并尝试了以下解决方案,但到目前为止没有任何效果:
I searched and tried the following solution but nothing has worked so far:
- 清洁&构建项目
- 已删除 .gradle &.dart_tools 文件夹
- 降级的 Gradle 版本
我使用的是 Android Studio 4.2.1.需要帮助请叫我.提前致谢!
I'm using Android studio 4.2.1. Let me know if you need anything else. Thanks in advance!
答
我尝试了很多解决方案,但以下对我有用:
I tried many solutions but the following worked for me:
- 将 Flutter 版本从 2.2.3 降级到 2.2.2
- 删除 ~/.android 文件夹,然后运行 flutter 项目.一切正常.