环境搭建与工具链
React Native 开发环境搭建与工具链介绍
iOS 环境搭建
必须安装的依赖有:Node、
Node, Watchman
我们推荐使用 Homebrew 来安装
brew install node
brew install watchman
如果你已经安装了
设置
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
或者使用 nrm:
$ nrm ls
* npm ----- https://registry.npmjs.org/
cnpm ---- http://r.cnpmjs.org/
taobao -- https://registry.npm.taobao.org/
nj ------ https://registry.nodejitsu.com/
skimdb -- https://skimdb.npmjs.com/registry
$ nrm use cnpm //switch registry to cnpm
Registry has been set to: http://r.cnpmjs.org/
Watchman 则是由
Yarn、React Native 的命令行工具(react-native-cli)
npm install -g yarn react-native-cli
安装完
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
安装完
Xcode
Xcode 的命令行工具
启动Xcode | Preferences | Locations
菜单中检查一下是否装有某个版本的 Command Line Tools
。git
等。

搭建Android 开发环境
必须安装的依赖有:Node、
Java Development Kit
javac -version
来查看你当前安装的
Android 开发环境
安装Android Studio
首先下载和安装 Android Studio,国内用户可能无法打开官方链接,请自行使用搜索引擎搜索可用的下载链接。安装界面中选择
- Android SDK
- Android SDK Platform
- Performance (Intel ® HAXM)
- Android Virtual Device
然后点击
安装Android SDK
你可以在Appearance & Behavior → System Settings → Android SDK
。

在
- Android SDK Platform 28
- Intel x86 Atom_64 System Image(官方模拟器镜像文件,使用非官方模拟器不需要安装此组件)