[英]How to fix “Finished with error: Gradle task assembleDebug failed with exit code -1” error when i run flutter project
"Finished with error: Gradle task assembleDebug failed with exit code -1" “以错误结束:Gradle 任务 assembleDebug 失败,退出代码 -1”
I make a new basic flutter project, and I got this error when I run flutter doctor everything is well, no issues detected.我创建了一个新的基本 flutter 项目,当我运行 flutter 医生时出现此错误,一切都很好,没有检测到问题。 I have tried flutter clean, and try to rebuild and the messages are the same.
我试过 flutter 干净,并尝试重建,消息是一样的。 anyone can help me please to fix this problem.
任何人都可以帮助我解决这个问题。
error:错误:
Flutter doctor: Flutter博士:
logcat:日志猫:
device connected:连接的设备:
Open your android folder with the android studio it'll help you to find out whats the issue.使用 android 工作室打开您的 android 文件夹,它将帮助您找出问题所在。 also, check this answer too.
另外,请检查此答案。
Flutter provides a command to update the Android SDK path: Flutter提供更新Android SDK路径的命令:
Use flutter config --android-sdk <path-to-your-android-sdk-path>
使用
flutter config --android-sdk <path-to-your-android-sdk-path>
I got same error code a few days ago when I try to run all my Flutter projects.几天前,当我尝试运行我所有的 Flutter 项目时,我得到了相同的错误代码。 To make sure you encounter the same problem as I did;
确保您遇到与我相同的问题;
First, go to your project directory -> open android folder -> check if there's a gradlew.bat
file inside.首先,go 到你的项目目录 -> 打开 android 文件夹 -> 检查里面是否有
gradlew.bat
文件。 <project_name>\android\gradlew.bat
. <project_name>\android\gradlew.bat
。 If there's no such file, then you can follow along.如果没有这样的文件,那么您可以跟随。
Here's what I did:这是我所做的:
flutter create -t <project_name>
, by using this command, it will ensure that there will be gradlew.bat
file inside the project.flutter create -t <project_name>
,通过使用该命令,可以确保项目内部有gradlew.bat
文件。<project_name>\android
, copy that gradlew.bat
file. <project_name>\android
,复制该gradlew.bat
文件。<project_name>\android
) of one of your current not-working Flutter project.<project_name>\android
)。flutter run
command on that project.flutter run
命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.