文章目录
- FVM官网
- 参考
- 1.安装
- 2.配置FVM环境变量
- 3.修改一下fvm文件缓存地址,以免以后下载的flutter sdk下载到C盘
- 4. 默认fvm的下载地址是在C盘,修改fvm缓存地址
- 5.下载安装Flutter SDK
- 6. 将原来电脑上的SDK复制到E:\Flutter\FlutterSDK\ 下改名为版本号
- 7.系统path中的默认Flutter路径修改
- 8.SDK版本切换
- 在CMD窗口通过fvm list可以查看fvm中已经缓存的所有sdk版本
- 使用fvm use<版本号>命令时一定要在管理员模式 下打开
- 切换完成后使用fvm flutter doctor。配置对应的环境
- 9. Android Studio中设置
- 10.最终运行
- 分享开源的FVM 窗口化管理软件 sidekick
FVM官网
https://fvm.app/docs/getting_started/installation/
参考
https://www.cnblogs.com/ybmj/p/15955420.html
http://www.manongjc.com/detail/28-pusxchmmantflah.html
安装前电脑里已经有了flutter ,版本太高导致很多旧版本运行不起来。
原先已经有了环境变量的配置。
E:\*****\bin
E:\*****\flutter\bin\cache\dart-sdk\bin
1.安装
dart pub global activate fvm
Warning: Pub installs executables into C:\Users\Administrator\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system’s “Path” environment variable.
2.配置FVM环境变量
将上面的 警告里路径复制下来 ,添加到环境变量中~
完成后测试
fvm
出现 Flutter Version Management: A cli to manage Flutter SDK versions.
3.修改一下fvm文件缓存地址,以免以后下载的flutter sdk下载到C盘
4. 默认fvm的下载地址是在C盘,修改fvm缓存地址
fvm config --cache-path E:\Flutter\FlutterSDK\
5.下载安装Flutter SDK
1.使用命令下载
fvm install 版本号
fvm install 2.10.0
2.Flutter中文资源网https://flutter.cn/docs/development/tools/sdk/releases,使用IDM等软件下载压缩包,解压到E:\Flutter\FlutterSDK\文件夹中
6. 将原来电脑上的SDK复制到E:\Flutter\FlutterSDK\ 下改名为版本号
这是我原先的版本3.9.0
复制时可能会出现文件占用的问题,我是直接重启解决的~
2.10.0 是上一步用命令下载的。
7.系统path中的默认Flutter路径修改
修改的路径是上一步复制的文件夹下~
配置好了就 关掉bat窗口 重新 cmd
C:\Users\Administrator>fvm list
Cache Directory: E:\Flutter\FlutterSDK3.9.0-1.0
2.10.0
8.SDK版本切换
在CMD窗口通过fvm list可以查看fvm中已经缓存的所有sdk版本
使用fvm use<版本号>命令时一定要在管理员模式 下打开
切换完成后使用fvm flutter doctor。配置对应的环境
出现问题1:
S E:\Demo\flutter_demo\flutter_luckin_coffee-v2.0> fvm flutter doctor
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.10.0, on Microsoft Windows [Version 10.0.15063], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2017 15.9.4)X Visual Studio 2019 or later is required.Download at https://visualstudio.microsoft.com/downloads/.Please install the "Desktop development with C++" workload, including all of its default components
[!] Android Studio (version 2022.1)X Unable to find bundled Java version.
[√] VS Code, 64-bit edition (version 1.77.0)
[√] Connected device (3 available)
[!] HTTP Host AvailabilityX HTTP host https://maven.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host: 信号灯超时时间已到
解决:
找到切换到的的 flutter sdk 安装目录,在此目录下找到 \packages\flutter_tools\gradle 文件夹,打开 flutter.gradle 文件,搜索 buildscript,(我的目录是E:\Flutter\FlutterSDK\2.10.0\packages\flutter_tools\gradle)
maven { url 'https://maven.aliyun.com/repository/jcenter' }maven { url 'http://maven.aliyun.com/nexus/content/groups/public'}maven { url 'https://dl.google.com/dl/android/maven2/'}
问题2:,出现OpenSSL SSL_read: Connection was reset, errno 10054
C:\Windows\System32>fvm install 2.10.5
Flutter "2.10.5" is not installed.Installing version: 2.10.5...
Cloning into 'E:\Flutter\FlutterSDK\2.10.5'...
fatal: unable to access 'https://github.com/flutter/flutter.git/': OpenSSL SSL_read: Connection was reset, errno 10054Could not install 2.10.5Please run command with --verbose if you want more information
解决 参考https://www.jianshu.com/p/8148e943b07e:
法一:
git config --global http.postBuffer 524288000
法二:
git config --global http.sslVerify false
问题3:
PS E:\Demo\flutter_demo\flutter_luckin_coffee> fvm flutter doctor
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.15063], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2017 15.9.4)X Visual Studio 2019 or later is required.Download at https://visualstudio.microsoft.com/downloads/.Please install the "Desktop development with C++" workload, including all of its default components
[!] Android Studio (version 2022.1)X Unable to find bundled Java version.
解决方法:
https://blog.csdn.net/woshidanoob/article/details/128779709
9. Android Studio中设置
10.最终运行
fvm flutter run
分享开源的FVM 窗口化管理软件 sidekick
sidekick开源地址:
https://github.com/fluttertools/sidekick
注意:程序需要 管理员模式 打开