Mac OSX系统搭建React natvie for android 开发环境

1.下载node.js https://nodejs.org/en/ 下载OSX版本 V5.6

2.安装android SDK JDK

3.安装react-native-cli

打开命令行,输入npm install -g react-native-cli

出现错误: Missing write access to /usr/local/lib/node_modules

/usr/local/lib 添加 sudo 命令

4.初始化react-native init AwesomeProject 需要FQ

5启动React Native Server

命令行进入AwesomeProject目录,执行react-native start开启server

6.开始进入AwesomeProject android项目

错误: Can't find variable: __fbBatchedBridge

Got JS Exception: ReferenceError: Can't find variable: __fbBatchedBridge

打开权限通知框。会出现红色的错误。怎么解决。

打开 http://localhost:8081/index.android.bundle?platform=android 是否正确

输入:adb reverse tcp:8081 tcp:8081

或者参考官网说明:http://facebook.github.io/react-native/docs/running-on-device-android.html

然后就会出现久违的welcome react native 页了。。

PS:基本android sdk 和jdk 没有写,,安装android studio