React Native
来源:互联网 发布:价值投资数据类app 编辑:程序博客网 时间:2024/06/05 04:02
React Native 开篇
近期打算入脑RN,把踩到的坑及心得记录下来:
- 搭建开发环境
- 可能会碰到的问题
- 编辑器的选择
- 测试安装
搭建开发环境
参考http://reactnative.cn/
可能会碰到的问题
安装Watchman时, 运行./autogen.sh :
./autogen.sh: 9: ./autogen.sh: aclocal: not found./autogen.sh: 10: ./autogen.sh: autoheader: not found./autogen.sh: 11: ./autogen.sh: automake: not found./autogen.sh: 12: ./autogen.sh: autoconf: not found
解决方法:
sudo apt-get install autoconf
安装Watchman时, 执行make :
pywatchman/bser.c:31:20: fatal error: Python.h: 没有那个文件或目录 #include <Python.h> ^compilation terminated.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1make[1]: *** [py-build] 错误 1
解决方法:
sudo apt-get install python-dev
安装Flow时, 执行npm install -g flow-bin :
npm ERR! tar.unpack untar error /home/zhuzi/.npm/flow-bin/0.36.0/package.tgznpm ERR! Linux 3.13.0-79-genericnpm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "flow-bin"npm ERR! node v4.6.2npm ERR! npm v2.15.11npm ERR! path /usr/lib/node_modules/flow-binnpm ERR! code EACCESnpm ERR! errno -13npm ERR! syscall mkdir....npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',npm ERR! 'FSReqWrap.oncomplete (fs.js:82:15)' ] }npm ERR! npm ERR! Please try running this command again as root/Administrator.npm ERR! Please include the following file with any support request:
解决方法:
sudo npm install -g flow-bin
编辑器的选择
根据多年的开发经验,还是直接上手Facebook的亲儿子Nuclide吧,Nuclide是由Facebook提供的基于atom的集成开发环境,可用于编写、运行和 调试React Native应用。
安装atom:
sudo add-apt-repository ppa:webupd8team/atom sudo apt-get update sudo apt-get install atom
安装nuclide插件到atom, nuclide的已经开源 https://github.com/facebook/nuclide
安装过程参考https://nuclide.io/docs/editor/setup/#linux
打开Atom 在welcome guide中点击install a package 在install package界面的搜索框里输入nuclide然后回车 搜索出来后点击安装
整个过程没有遇到需要调整上网姿势的问题,开心!
测试安装
react-native init AwesomeProjectcd AwesomeProjectreact-native run-android
碰到的问题,执行react-native run-android时,竟然强势要求build tools是23.0.1,我的环境有23.0.2 , 24+都编译不过。没办法,只好再补一个23.0.1。
然后我有碰到下面的错误
FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:installDebug'.> com.android.builder.testing.api.DeviceException: No connected devices!
好吧,那就打开模拟器或者连接一个可以debug的手机吧
ok, 再次运行react-native run-android终于见到
Installing APK 'app-debug.apk' on 'Galaxy_Nexus_API_21(AVD) - 5.0.2'Installed on 1 device.BUILD SUCCESSFULTotal time: 9.699 secs
那么,代码什么结构,什么原理,持续研究中
1 0
- react native
- React Native
- React Native
- React- Native
- react-native
- React Native
- React Native
- react native
- React Native
- react-native
- React Native
- react native
- React Native
- React Native
- React Native
- React Native
- react native
- React Native
- ASCII码对应表chr
- 拓扑排序DFS做法
- INSTALL_PARSE_FAILED_MANIFEST_MALFORMED问题的解决
- RecyclerView加载网络图片防止图片错乱问题
- 【u118】日志分析
- React Native
- 使用MyEclipse开发HBase应用程序
- 拓扑排序的BFS做法
- Regional 2014 - Asia Mudanjiang - F Fiber-optic Network
- .tbd和.dylib
- 如何获得领导赏识
- Caffe: 安装Caffe的最快捷方法
- BUCK电路分析
- udacity assignment1