windows搭建flutter运行环境
一、运行 flutter doctor遇到的问题
c
Xcmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
1)cmdline-tools问题
步骤1:打开Android Studio-SDK Manager
步骤2:SDK-Tools-Android sDK command-line Tools (atest)
** 确认安装,再次运行flutter doctor警告没了**
2)警告Some Android licenses not accepted.To resolve this,run:flutter doctor --android-licenses
运行flutter doctor --android-licenses
一直输y
然后回车就行了
3)遇到 Network resources
c
Network resources
X A network error occurred while checking "https://github.com/": 信号灯超时时间已到
解决方法1:配置环境变量(如果有代理,就打开)
cpp
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
PUB_HOSTED_URL=https://pub.flutter-io.cn
4)控制台有Android Studio(version 2024.2)和Android Studio(version 2024.1)两个显示
出现原因:之前安装的版本2,卸载了,还有残留,删掉之前的内容,在运行flutter doctor
就不会出现了
二、启动导入的flutter 项目遇到的问题
1)Exception in thread "main" java.util.zip.ZipException: zip END header not found
原因:gradle下载不完整导致的错误
解决方法1:升级gradle,换成其它版本(编译可能会出现兼容问题)
解决方法2:找到存储gradle的目录,删掉之前的包,重新运行
解决方法3:去官网下载安装包,放在相应版本的目录,重新运行
2) what went wrong: the android gradle plugin supports only kotlin gradle plugin version 1.5.20 and higher. the following dependencies do not satisfy the required version: project ':flutter_facebook_sdk' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
注:注意查看自己具体报错的提示的是哪个sdk,我的报错的是flutter_facebook_sdk,所以改的这个
解决方法:build.gradle中修改成ext.kotlin_version = '1.5.20'
更改如下:
小菜鸟持续更新中...2024/11/20