Flutter环境位置
2020-04-26 本文已影响0人
Janek_m
1、更新HomeBrew 没有去下载!
2、官网下载flutter 最新版flutter 官网
如果你使用默认的bash那么配置 ~/.bash_profile
如果你使用zsh那么配置~/.zshrc
---->>>> vim ~/.bash_profile
--- (open -e .bash_profile 打开)
--- (source .bash_profile 更新刚刚配置)
--- (echo $PATH 验证目录是否在已经在PATH中)
--- (flutter doctor 检测-按照上面的步骤保险点,直接在终端有时候找不到命令)
------------------------------
#git clone -b beta https://github.com/flutter/flutter.git 下载
#Flutter 镜像配置
$ export PUB_HOSTED_URL=https://pub.flutter-io.cn
$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
#Flutter SDK 安装的路径
export PATH=${PATH}:/Users/wld/j_mac/flutter/bin:$PATH
#Android NDK路径
export ANDROID_NDK_HOME=~/Library/Android/ndk/android-ndk-r10e
#安卓---(cd 资源库/Android/sdk)
export ANDROID_HOME=~/Library/Android/sdk
#安卓模拟器路径
export PATH=${PATH}:${ANDROID_HOME}/emulator
#安卓tools路径
export PATH=${PATH}:${ANDROID_HOME}/tools
#安卓 平台工具
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
3、错误信息 Android toolchain - develop for Android devices (Android SDK version 29.0.0)
Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit visit
https://flutter.dev/docs/get-started/install/macos#android-setup for
detailed instructions.
问题解决 : flutter doctor --android-licenses
PS > flutter doctor --android-licenses
A newer version of the Android SDK is required. To update, run:
C:\Users\Administrator\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
根据提示,输入
C:\Users\Administrator\AppData\Local\Android\sdk\tools\bin\sdkmanager --update 即可
3、配置Xcode命令行工具以使用新安装的Xcode版本:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer (如果有多个Xcode请指定路径)
- 3.1 将Flutter应用安装到iOS设备的工具:[不下载了需要翻墙)
brew install --HEAD libimobiledevice
brew install ideviceinstaller
brew install ios-deploy
brew install cocoapods
pod setup
5、Connected device (1 available) 错误:
$ open -a Simulator (打开模拟器即可)