flutter环境之安装FVM

1:  一定要安装 choco
用管理员身份运行 cmd | Powershell
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

否则不好全局管理FVM,全部输入Y

2: choco install fvm

3:  fvm config --cache-path D:\fvm\

4: 在用户环境变量中添加 FVM_HOME,设置为 D:\fvm\

5: fvm install 3.7.7

6: fvm global 3.7.7

7: 在path里添加  D:\fvm\default\bin  和  D:\fvm\default\bin\cache\dart-sdk\bin

8: path里删除安装choco时添加的 C:\tools\dart-sdk\bin

9: vscode里setting里搜索flutterSdkPaths   输入 D:/fvm/  就可以在vscode里change sdk了

10:完成 !

https://fvm.app/docs/guides/faq/#environment-variables-order-for-windows-in-path

-------------------------------------------------------------------------------------------------------------------

Invalid kernel binary or invalid sdk hash when running FVM​

There are a few reasons this can happen. However it means that the FVM snapshot is not compatible with the Dart version that is installed.

Please do the following:

  1. On Windows make sure your env variables are in the following order as described here.
  2. Run dart pub global deactivate fvm
  3. Run dart pub global activate fvm

-------------------------------------------------------------------------------------------------------------------

Environment variables order for Windows in PATH​

Flutter comes with Dart embedded. Because of that you can find some conflicts when running standalone Dart and Flutter together. Here is a suggestion of what we found to be the correct order of dependencies to avoid issues.

  1. Pub Cache for global packages
  2. Dart SDK (if installed outside of Flutter)
  3. Flutter SDK

It should look like this.

C:\Users\\AppData\Roaming\Pub\Cache\bin
C:\src\flutter\bin\cache\dart-sdk\bin
C:\src\flutter\bin

你可能感兴趣的:(flutter,android,studio,android)