本文介绍了Flutter错误:无法找到gradlew脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法运行我所有的flutter应用程序,因为每次出现以下错误消息时,控制台中都会出现该消息:

I can't run all of my flutter apps, because in the console appears everytime this error message:

Downloading Gradle Wrapper...                                       1,2s
Launching lib\main.dart on SM G960F in debug mode...
Running Gradle task 'assembleDebug'...
Finished with error: Unable to locate gradlew script. Please check that C:\Users\...\android\gradlew.bat exists or that C:\Users\...\android can be read.

我尝试解决这个问题超过十个小时,但没有找到解决方案.

I try to fix this problem more than ten hours and don't find a solution.

推荐答案

错误提示,表明某些原因 防止gradle在计算机上正常运行 .检查计算机上是否有不需要的程序或防病毒程序在运行,可能无法阻止gradle的运行.如果是这样,请删除或停止这些程序/防病毒,然后重试.

然后,删除包含未完成文件的 .gradle 文件夹,位于此处 C:\ Users \ yourPcName \ .gradle ,然后重试.现在可以使用了.

After that, delete the .gradle folder located here C:\Users\yourPcName\.gradle containing the unfinished file and try again . It will work now .

您还可以手动下载Gradle并将其映射到Android Studio中,有关本文的更多信息,请参见此处.

You can also manually download Gradle and map it in Android studio , Learn more with this article here .


如果仍然无法正常工作,尝试运行 flutter --doctor

在路径中包含Flutter目录的控制台窗口中(请参见上文),运行以下命令以查看是否需要任何平台依赖项来完成设置:

From a console window that has the Flutter directory in the path (see above), run the following command to see if there are any platform dependencies you need to complete the setup:

C:\src\flutter> : flutter doctor

此命令检查您的环境并显示Flutter安装状态的报告.请仔细检查输出,以了解您可能需要安装的其他软件或要执行的其他任务(以粗体显示).

This command checks your environment and displays a report of the status of your Flutter installation. Check the output carefully for other software you might need to install or further tasks to perform (shown in bold text).

您可以在此处了解更多信息:

You can learn more here :

这篇关于Flutter错误:无法找到gradlew脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 12:13
查看更多