按照http://reactnative.cn/docs/0.46/getting-started.html#content提供的步骤一步一步地来,也会出错,现在记录一下遇到的坑
1、运行iOS,报错 Print: Entry, ":CFBundleIdentifier", Does Not Exist
a.尝试reset一下模拟器之后再,react-native run-ios
点击模拟器Simulator,里面有Reset Content and Settings
b. 新建指定项目版本,目前最新版本是0.46
react-native init myapp --version 0.44.3
2、创建项目时提示:Failed to downloadhttps://yarnpkg.com/latest.tar.gz,
里面还有一句: Consider installing yarn to make this faster:https://yarnpkg.com
在终端输入命令:npm install -g yarn
安装后查看版本:yarn --version,然后再重新创建项目即可
3、运行Android时react-native run-android提示:“Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:https://facebook.github.io/react-native/docs/android-setup.html”
打开Android SDK Manager,确保如下工具和开发包已经安装:
SDK:
- Android SDK Build-tools version 23.0.1
- Android 6.0(API 23)
- Android Support Repository
模拟器:
- Intel x86 Atom System Image(for Android 5.1.1 - API 22)
- Intel x86 Emulator Accelerator(HAXM installer)
4、链接RCTCameraRoll库时,报错:error Couldn't find package "RCTCameraRoll" on the "npm" registry
1.npm install RCTCameraRoll --save
2.用XCode打开项目,在Libraries文件夹右击-》Add Files,在出来的文件选择中选择node_modules/RCTCameraRoll/这个文件夹,找到RCTCameraRoll.xcodeproj这个文件,并添加
3.选择Build Phases中的Link Binary With Libraries中添加libRCTCameraRoll.a
5、报错,-bash: adb: command not found
参考:http://blog.sina.com.cn/s/blog_540316260101ftge.html
6.
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
就是没有能连接的设备,我的是mac系统的,就需要装一下genymotion,教程
http://blog.csdn.net/iosbird/article/details/76231570
后续待更。。。。。