运行 React Native 的默认工程 UIExplorer
使用 React Native 框架可以使用相同的代码编写不同平台的应用. 在学习过程中,既会兼顾老朋友 工作环境是 时间: 2016年4月6日,
Android配置GitHub 的 下载 React Native 项目 git clone https://github.com/facebook/react-native.git 进入 ./gradlew :Examples:UIExplorer:android:app:installDebug
构建完成之后,RN 的 App 已经成功安装到手机中. 常见错误下载失败: 需要删除文件,重新下载即可,如: Could not expand ZIP '/Users/wangchenlong/Exercises/ReactNative/react-native/ReactAndroid/build/downloads/boost_1_57_0.zip'
删除即可 rm /Users/wangchenlong/Exercises/ReactNative/react-native/ReactAndroid/build/downloads/boost_1_57_0.zip
安装错误: Gradle 的编译版本过高,不兼容部分5.0+手机,需要降低版本为 1.3. Installing APK 'app-debug.apk' on 'HUAWEI GRA-TL00 - 5.0.1' for app:debug
Error while uploading app-debug.apk : Unknown failure ([CDS]close[0])
使用 buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3' // 修改1.2.3
classpath 'de.undercouch:gradle-download-task:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
需要重新设置 Gradle 的 Wrapper,修改为2.2版本. Gradle version 2.2 is required. Current version is 2.11
NDK路径: 在工程的 ndk.dir=/Users/wangchenlong/Installations/android-ndk-r10e
服务配置安装 NPM 的插件,可能会需要权限进行存储,时间较长,耐心等待. sudo npm install
修改 ADB 的 TCP 端口号,映射为8081,针对于5.0以上手机有效. adb reverse tcp:8081 tcp:8081
启动服务 npm start 晃动 Android 手机,即进入菜单页面,选择 OK,Android 项目加载成功! 修改下载源使用淘宝的 npm config set registry=http://registry.npm.taobao.org/
配置地址在根目录的 registry=http://registry.npm.taobao.org/ iOS配置相比于 Android 配置的复杂性,iOS 配置比较简单. 需要升级 在 Xcode 中,启动 不要关闭服务,运行项目,会自动加载数据. Android 和 iOS 的配置都已经完成,都可以运行自带 Demo - 让我们继续学习新的知识吧,运行 OK,that’s all! Enjoy it!
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |