Last active
July 8, 2021 02:17
-
-
Save hhstore/43f496988512b713be29a083f4ad8a1e to your computer and use it in GitHub Desktop.
set env for flutter and android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################################################### | |
# for android: | |
####################################################### | |
# https://developer.android.com/studio/command-line/variables?hl=zh-cn | |
export ANDROID_SDK_ROOT="$HOME/sdk/android" | |
# | |
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator | |
export PATH=$PATH:$ANDROID_SDK_ROOT/tools | |
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin | |
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools | |
####################################################### | |
# for flutter: | |
# 首次配置 Android 开发环境: | |
# - fvm flutter doctor -v | |
# - flutter doctor --android-licenses | |
####################################################### | |
# flutter: | |
# export PATH="$PATH":"$HOME/sdk/flutter/bin/cache/dart-sdk/bin" | |
export PATH="$PATH":"$HOME/.pub-cache/bin" | |
# fvm: | |
export FVM_HOME="$HOME/.fvm" | |
# use fvm: fluter + dart + pub | |
export PATH="$PATH":"$HOME/.fvm/default/bin":"$HOME/.fvm/default/bin/cache/dart-sdk/bin" | |
function set.proxy.flutter.cn(){ | |
# mirror: https://mirrors.tuna.tsinghua.edu.cn/help/flutter/ | |
# 社区: | |
export PUB_HOSTED_URL=https://pub.flutter-io.cn | |
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn | |
# 清华大学: | |
#export FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter" | |
#export PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub" | |
} | |
# 国外: 官方 | |
function set.proxy.flutter.us(){ | |
export PUB_HOSTED_URL=https://pub.dartlang.org | |
export FLUTTER_STORAGE_BASE_URL=https://storage.dartlang.org | |
} | |
# 安装 fvm: | |
function install.fvm(){ | |
brew tap leoafarias/fvm | |
brew install fvm | |
} | |
# 卸载 fvm: | |
function uninstall.fvm(){ | |
brew uninstall fvm | |
brew untap leoafarias/fvm | |
} | |
# defalut use cn mirror: | |
set.proxy.flutter.cn | |
# unset: | |
function unset.proxy.flutter() { | |
unset PUB_HOSTED_URL | |
unset FLUTTER_STORAGE_BASE_URL | |
echo "unset flutter proxy" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
related: