#一波命令行全部搞定,连Android Studio都不用装,推荐使用Visual Studio Code作为IDE
#设置代理,谷歌的东西很多被墙,你懂的
set http_proxy='http://127.0.0.1:1087'
set https_proxy='https://127.0.0.1:1087'
set socks5_proxy='socks5://127.0.0.1:1086'
#安装HomeBrew并通过Brew安装java、安卓sdk
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew cask install caskroom/versions/java8 android-sdk android-platform-tools
/usr/local/Caskroom/android-sdk/4333796/tools/android update sdk --use-sdk-wrapper
# 4333796 是安装的android-sdk的版本,请自行去/usr/local/Caskroom/android-sdk/查看版本号做相应修改
#修改环境变量
nano ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=/usr/local/Caskroom/android-sdk/4333796
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:${JAVA_HOME}/bin
source ~/.bash_profile
#同意安卓开发协议
yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;28.0.3"
#安装React Native新建项目并在安卓上运行
brew install node watchman yarn
npm install -g react-native-cli
react-native init AwesomeProject --template typescript
cd AwesomeProject
yarn add react-navigation react-native-gesture-handler
react-native link react-native-gesture-handler
react-native run-android