美文网首页
如何从source运行react native

如何从source运行react native

作者: ironman_ | 来源:发表于2017-09-04 20:38 被阅读0次

尝试着从源码编辑运行react native的源码,很简单,但是会有一些坑。

1、从react native官网clone代码下来:

git clone [https://github.com/facebook/react-native.git](https://github.com/facebook/react-native.git)

2、使用android studio导入项目,选择最外面的build.gradle就可以

配置ndk目录位置,需要使用ndk版本r10e

各个版本的位置:
Mac OS (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip
Linux (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
Windows (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-windows-x86_64.zip
Windows (32-bit) - http://dl.google.com/android/repository/android-ndk-r10e-windows-x86.zip

3、点击绿色的按钮运行,首次运行需要下载大概200M的东西,需要等一会,如果有代理最好配置代理,不然下载更慢。

运行完了之后手机上肯定是红屏,因为server没有起起来

4、在项目跟目录下运行:

npm install

等到运行完成之后运行:

npm start

这时候服务端应该顺利的启动起来了(置于如何手机如何配置代理等等可以去rn中文网看看)

这时候就可以为所欲为改代码了。
参考文章:
https://facebook.github.io/react-native/docs/android-building-from-source.html
(中文站点:http://reactnative.cn/docs/0.47/android-building-from-source.html#content

相关文章

网友评论

      本文标题:如何从source运行react native

      本文链接:https://www.haomeiwen.com/subject/hzfyjxtx.html