Flutter环境配置
问题1:
flutter sdk下载
flutter sdk下在可以通过这两种方式,但是第一个下载完配置环境后执行flutter doctor时终端报错信息如下:
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
得通过方法二的github方式下载下来然后配置环境执行flutter doctor问题解决。
具体可以参考这篇文章:
Flutter 开发遇到的配置问题
问题2:
Flutter SDK is not found in the specified location.
在指定位置找不到Flutter SDK
- 路径指向的不对,一般是flutter sdk的当前路径例如:/Users/super/Library/flutter
- 路径没问题,可能是ide识别路径不准确的问题,多尝试几次指向路径就可以了。
问题3:
Cannot run with sound null safety, because the following dependencies
解决方案:english_words依赖包的版本问题,可以换个版本,有问题的是3.1.0.我换成了4.0.0就没问题了
问题4:
Flutter App Run卡在Running Gradle task ‘assembleDebug’…
电脑所用wifi限制外网访问 下载不了Gradle
解决方案:需要使用阿里云的镜像地址。
修改项目中android/build.gradle文件
修改内容如下:
maven {
url ‘https://maven.aliyun.com/repository/google’ }
maven {
url ‘https://maven.aliyun.com/repository/jcenter’ }
maven {
url ‘http://maven.aliyun.com/nexus/content/groups/public’ }