Flutter环境搭建采坑大全,报错The Flutter directory is not a clone of the GitHub project和Error running Gradle及解决

本文主要是介绍Flutter环境搭建采坑大全,报错The Flutter directory is not a clone of the GitHub project和Error running Gradle及解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.安装Flutter,推荐 Flutter中文网

这个网站的介绍还是比较全,国内需要配置临时镜像,配在用户变量就行,我是直接配在系统变量里,如下图

在github上下载完Flutter后并解压,记得在Path里配flutter的环境

重启让环境变量生效,在基本操作都做完后打开cmd无比激动的敲下了flutter doct

Error: The Flutter directory is not a clone of the GitHub project.The flutter tool requires Git in order to operate properly;to set up Flutter, run the following command:git clone -b beta https://github.com/flutter/flutter.git
  • 解决方法

    把刚刚下载的Flutter安装包删掉,重新在想要安装的目录下运行git clone -b beta https://github.com/flutter/flutter.git

等待下载完毕,再次验证,看到如下图说明安装成功(感谢https://segmentfault.com/a/1190000017403839)

2.使用Android studio3.0以上创建你的第一个flutter项目New Flutter Project

打开File->New ->发现没有New Flutter Project

解决:

然后配上Flutter安装目录

然后就可以愉快的创建第一个flutter项目,一路默认就行(感谢https://www.cnblogs.com/niceyoo/p/9240359.html)

3.运行项目

3.1Error running Gradle 错误 

首先修改项目build.gradle,注释掉jcenter(),google()。使用阿里的镜像。原因是jcenter google库无法访问到导致的问题。虽然我有万能的爬墙工具,开启全局代理依然被我们伟大的发改委墙掉了!

然后找到flutter安装目录的flutter.gradle文件

修改跟上面一样,如下图

 

3.2 出现如下错误的解决办法

ProcessException: Process “D:\project\Flutter\flutter_app\android\gradlew.bat” exited abnormally:

> Configure project :app
Checking the license for package Android SDK Platform 28 in C:\Users\Administrator.WINMICR-H4QQDHF\AppData\Local\Android\Sdk\licenses
Warning: License for package Android SDK Platform 28 not accepted.
FAILURE: Build failed with an exception.

* Where:
Build file ‘D:\project\Flutter\flutter_app\android\build.gradle’ line: 30

* What went wrong:
A problem occurred evaluating root project ‘android’.
> A problem occurred configuring project ‘:app’.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

大概的意思就是需要您接受SDK许可协议,根据上面SDK的地址,找到bin目录,如下

在此目录 按住shitf键同时右击,在此处打开命令窗口,cmd里输入sdkmanager --licenses

一路按y,回车到最后就行了,表示同意协议。

最后来一张运行图

谢谢大家,如有不对请指出,感谢!

这篇关于Flutter环境搭建采坑大全,报错The Flutter directory is not a clone of the GitHub project和Error running Gradle及解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/652890

相关文章

mybatis和mybatis-plus设置值为null不起作用问题及解决

《mybatis和mybatis-plus设置值为null不起作用问题及解决》Mybatis-Plus的FieldStrategy主要用于控制新增、更新和查询时对空值的处理策略,通过配置不同的策略类型... 目录MyBATis-plusFieldStrategy作用FieldStrategy类型每种策略的作

Python Jupyter Notebook导包报错问题及解决

《PythonJupyterNotebook导包报错问题及解决》在conda环境中安装包后,JupyterNotebook导入时出现ImportError,可能是由于包版本不对应或版本太高,解决方... 目录问题解决方法重新安装Jupyter NoteBook 更改Kernel总结问题在conda上安装了

Goland debug失效详细解决步骤(合集)

《Golanddebug失效详细解决步骤(合集)》今天用Goland开发时,打断点,以debug方式运行,发现程序并没有断住,程序跳过了断点,直接运行结束,网上搜寻了大量文章,最后得以解决,特此在这... 目录Bug:Goland debug失效详细解决步骤【合集】情况一:Go或Goland架构不对情况二:

解决jupyterLab打开后出现Config option `template_path`not recognized by `ExporterCollapsibleHeadings`问题

《解决jupyterLab打开后出现Configoption`template_path`notrecognizedby`ExporterCollapsibleHeadings`问题》在Ju... 目录jupyterLab打开后出现“templandroidate_path”相关问题这是 tensorflo

如何解决Pycharm编辑内容时有光标的问题

《如何解决Pycharm编辑内容时有光标的问题》文章介绍了如何在PyCharm中配置VimEmulator插件,包括检查插件是否已安装、下载插件以及安装IdeaVim插件的步骤... 目录Pycharm编辑内容时有光标1.如果Vim Emulator前面有对勾2.www.chinasem.cn如果tools工

Python安装时常见报错以及解决方案

《Python安装时常见报错以及解决方案》:本文主要介绍在安装Python、配置环境变量、使用pip以及运行Python脚本时常见的错误及其解决方案,文中介绍的非常详细,需要的朋友可以参考下... 目录一、安装 python 时常见报错及解决方案(一)安装包下载失败(二)权限不足二、配置环境变量时常见报错及

Java多线程父线程向子线程传值问题及解决

《Java多线程父线程向子线程传值问题及解决》文章总结了5种解决父子之间数据传递困扰的解决方案,包括ThreadLocal+TaskDecorator、UserUtils、CustomTaskDeco... 目录1 背景2 ThreadLocal+TaskDecorator3 RequestContextH

解决JavaWeb-file.isDirectory()遇到的坑问题

《解决JavaWeb-file.isDirectory()遇到的坑问题》JavaWeb开发中,使用`file.isDirectory()`判断路径是否为文件夹时,需要特别注意:该方法只能判断已存在的文... 目录Jahttp://www.chinasem.cnvaWeb-file.isDirectory()遇

linux进程D状态的解决思路分享

《linux进程D状态的解决思路分享》在Linux系统中,进程在内核模式下等待I/O完成时会进入不间断睡眠状态(D状态),这种状态下,进程无法通过普通方式被杀死,本文通过实验模拟了这种状态,并分析了如... 目录1. 问题描述2. 问题分析3. 实验模拟3.1 使用losetup创建一个卷作为pv的磁盘3.

本地搭建DeepSeek-R1、WebUI的完整过程及访问

《本地搭建DeepSeek-R1、WebUI的完整过程及访问》:本文主要介绍本地搭建DeepSeek-R1、WebUI的完整过程及访问的相关资料,DeepSeek-R1是一个开源的人工智能平台,主... 目录背景       搭建准备基础概念搭建过程访问对话测试总结背景       最近几年,人工智能技术