【Building Projects with Native Code】html
一、安装Node(v4.0以上)、Python二、JDK(v8.0以上)。react
添加 JAVA_HOME环境变量,指向 JDK 的安装目录。android
二、安装 react-native-cligit
npm install -g react-native-cligithub
三、安装 android studionpm
四、安装 AndroidSDK Android 6.0 (Marshmallow) react-native
1)Configure -> SDK Manager -> SDK Platforms Tab,勾选上‘Show Package Details’,安装 Android6.0目录下的如下选项:优化
Google APIs
Android SDK Platform 23
Intel x86 Atom_64 System Image
Google APIs Intel x86 Atom_64 System Image
2)"SDK Tools" tab,勾选上‘Show Package Details’ui
选中"Android SDK Build-Tools"目录下的23.0.1spa
安装 1)、2)中的内容。
五、添加 ANDROID_HOME 环境变量,指向AndroidSDK。
-----------------------到此Android环境搭建完毕---------------------------------
六、建立项目
react-native init AwesomeProject
七、usb连上Android真机,确保真机上的 usb调试、usb安装均已开启,全MIUI优化被关闭。
八、构建并安装到直机
react-native run-android
九、当修改代码后,经过摇动手机来打开 'Developer Menu',选择Reload。
提示:若是你修改了native 代码或修改了Images.xcassets、res/drawable中的文件,从新加载js是不行的,这时你须要从新编译你的项目了。
十、Enable Live Reload
当 ctrl+s时,若是js代码有改动,自动将最新代码推送到手机上。Enable Live Reload须要每次都返回到启动页面。
十一、Hot Reloading
当 ctrl+s时,若是js代码有改动,自动将最新代码推送到手机上。Enable Live Reload则会在保持你的程序状态的状况下,就能够将最新的代码部署到设备上。
十二、console
参考:
一、https://facebook.github.io/react-native/docs/getting-started.html
二、http://blog.csdn.net/fengyuzhengfan/article/details/52106496