logo头像
Snippet 博客主题

flutter安装

mac下安装很简单,但是在Windows环境下有点小问题记录一下,安装java环境和安卓运行环境都没有遇到问题,主要是flutter安装的时候输入命令验证报错了
###win7 运行 flutter doctor 报错 无法将“Unblock-File”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
参考文章 https://juejin.im/post/6844903935522635784

安装gradle 、先下载好然后拷贝到C盘wrap目录下

AS安装flutter插件一直装不上是因为不会支持最新版AS,我换成了3.6.1版本就ok了

1
2
3
4
5
6
7
8
9
10
11
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more
details.
[√] Android Studio (version 3.6)
[√] Connected device (1 available)

! Doctor found issues in 1 category.

flutter doctor –android-licenses

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSche
ma
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.j
ava:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:8
1)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.jav
a:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.
java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more

问题是 jdk版本太高了

配置夜神模拟器

nox_adb.exe connect 127.0.0.1:62001

这个命令试了好几次才成功,中间各种重启最后才终于连上

image.png

Vscode命令行的关键键
r 键 :开启热重载
p 键: 显示布局网格
o 键:切换android 和 ios的预览模式
q 键:退出调试预览模式

终于准备好可以开始干了

sdk版本管理

先下载用的sdk到本地安装目录
open .bash_profile 编辑选择版本
source .bash_profile 让文件生效
然后在更改vscode 配置
image.png

重启vscode ,切换版本成功了

运行后又出现了下面的问题
image.png
按网上的解决直接删除
rm ios/Podfile

//执行了版本回退到 v1.5.4-hotfix.2
git reset –hard tag
flutter doctor后
出现以下问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.15.5 19F101, locale zh-Hans-CN)
✗ Downloaded executables cannot execute on host.
See https://github.com/flutter/flutter/issues/6207 for more information


[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[!] iOS toolchain - develop for iOS devices (Xcode 11.3.1)
✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.51.1)
[✓] Connected device (1 available)

! Doctor found issues in 2 categories.
微信打赏

赞赏是不耍流氓的鼓励