Mac 安装flutter 踩坑记
完整版请看链接:
http://b36d5043.wiz03.com/share/s/2Prl132RpQ3x2XpA4I2oTa2204K0FF0vB4J42tWIEQ04UrAg
首先下载flutter SDK; 解压的/Users/app/下
export ANDROID_HOME="/Users/用户名/xxx/xxx" //androi
d sdk目录,替换为你自己的即可 复制上面的路径,添加到全局环境变量
报错 Android license status unknown.
> flutter doctor --android-licenses
执行提示的命令:>
/Users/hewenke/Library/Android/sdk/tools/bin/sdkmanager --update
结果提示
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
>
sudo rm -fr /Library/referencesPanes/JavaControlPanel.prefpane
>ls /Library/Java/JavaVirtualMachines/
显示:jdk-12.0.1.jdk
>sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk
卸载成功:java -version //提示 No Java runtime present, requesting install.
安转 1.8java版本
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
>java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
安转1.8 完成。执行提示的命令:>
/Users/hewenke/Library/Android/sdk/tools/bin/sdkmanager --update
输入Y 回车
xcode-select: error: invalid developer directory '/Applications/Xcode.app/Contents/Developer'
hewenkedeMacBook-Pro:~ hewenke$ sudo xcodebuild -license
Password:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
hewenkedeMacBook-Pro:~ hewenke$
接着执行:brew update这几个步骤,一个一个执行;
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
brew install ios-deploy
brew install cocoapods
最后
pod setup //使用云墙安装 https://netfits.org.cn
执行flutter doctor 显示如下错误
//以上步骤都是有问题的,需要再appstore下载xcode安装,需要在http://www.android-studio.org下载androidstudio 安装。
安装了android Studio以后的显示,需要安装这两个工具;再加一个设备。
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer 再让医生看一下: ok