美文网首页
React Native

React Native

作者: 唯有她美 | 来源:发表于2019-02-19 20:08 被阅读0次

    运行别人的项目基本两点:

        其一:更换JSSDK

        其二:删除android/app/src/main/assets这是一个打包后的js文件

    官方网址:https://reactnative.cn/docs/0.51/getting-started.html#content

    @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

    表示安装成功

    如果无法安装powershell.exe

    iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

    出现上述的箭头指向说明安装成功

    打开

    1.安装Python2

    chocoinstallpython2

    2.安装node

    chocoinstallnodejs.install

    镜像加速

    npmconfig set registry https://registry.npm.taobao.org --global

    npmconfig set disturl https://npm.taobao.org/dist --global

    3.安装管理工具

    yarn或npm

    镜像加速

    yarn configsetregistry https://registry.npm.taobao.org--global

    yarn configsetdisturl https://npm.taobao.org/dist--global

    4.下载Android Studio 去官方下载

    记得配置SDK 官方有详细教程

    npm install -g react-native-cli

    react-native-cli是一个终端命令,它可以完成其余的设置工作。它可以通过npm安装。刚才这条命令会往你的终端安装一个叫做react-native的命令。这个安装过程你只需要进行一次。

    5.判断是否连接服务

    react-native start

    在浏览器打开http://localhost:8081/index.android.bundle?platform=android 能够输出一段代码就ok了

    6.连接安卓模拟器

    adb devices找设备

    打开cmd,输入:adb connect 127.0.0.1:26944。如下:

    海马玩模拟器的端口号是26944。

    逍遥安卓模拟器的端口号是21503。

    夜神玩模拟器的端口号是62001。

    其他模拟器同理,知道端口号就行了;

    7.输入 react-native run-android执行

    相关文章

      网友评论

          本文标题:React Native

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