React-Native 一:学习

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/mo_feng_/article/details/82180494

一、下载并运行一个github项目
1,下载,例如:
HelloRn
2,使用WebStorm打开项目
3,在Terminal中运行命令
npm install : 运行该命令是下载node_modules。每个项目都要运行该命令,下载node_modules。(可以用yarn install命令代替)等待若干时间下载,,,
react-native run-android:该命令用来运行Android项目
以上三步基本上都能把github项目运行成功,如果遇到错误,可以自行通过提示解决。
二、运行模拟器
1,查看模拟器地址

1.1、android list avd:该命令能查看到模拟器的名字和地址

eg:

 Name: Nexus_5_API_25
Device: Nexus 5 (Google)
Path: C:\Users\DELL.android\avd\Nexus_5_API_25.avd
Target: Google APIs (Google Inc.)
Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/armeabi-v7a
Skin: nexus_5
Sdcard: 100M

1.2、emulator -list-avds:该命令可以查看存在的模拟器
eg:
Nexus_5_API_25
Nexus_6P_API_25

2,运行模拟器
进入模拟器目录我的目录是:(C:\Users\xxx\AppData\Local\Android\Sdk\emulator),(Windows10通过按住Shift键,再鼠标右键“在此处打开Powershell窗口”),最后运行如下命令,例如
eg:emulator -avd Nexus_5_API_25

三、排错
1,has incorrect peer dependency:有不正确的对等依赖

warning " > react-test-renderer@16.4.2" has incorrect peer dependency "react@^16.0.0".

说白了就是,react-test-renderer@16版本与react@16版本

猜你喜欢

转载自blog.csdn.net/mo_feng_/article/details/82180494