react-native 安卓和ios端开发配置

快速删除命令:

windows: rmraf 要删除的文件夹

mac: rm -rf 要删除的文件夹

部分指令:

列出连接设备列表 adb devices 

真机调试:

安卓:

  需要 运行adb reverse tcp:8081 tcp:8081

 开启调试Ctrl+M  +start remote js Debugging

 chrome打开http://localhost:8081/debugger-ui

IOS:

需要 苹果开发者帐号

IOS 下调试 踩坑记录:

如果 打不开,则检查gradle等路径问题,如果红屏报错,检查是否react 和native的版本问题

如提示未连接服务器,则需要另起一个命令窗口node服务, 手动执行 react-native start

安卓下调试 踩坑记录:

1.提示版本不匹配,可修改项目中android-build.gradle 

classpath 'com.android.tools.build:gradle:2.2.3'

2.android studio 和 模拟器 qemu-system-i386占用非常高的内存,解决方法:

      (1)disable VCS by going to File->Settings->Plugins and disable the following:

  • CVS Integration
  • Git Integration
  • GitHub
  • Google Cloud Testing
  • Google Cloud Tools Core
  • Google Cloud Tools for Android Studio
  • hg4idea
  • Subversion Integration

      (2)关闭gradle 自动更新 勾选 offline work ,设置gradle路径,

  修改gradlew.bat 文件

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set GRADLE_OPTS=-Dgradle.user.home=/yourpath/user/.gradle
原文地址:https://www.cnblogs.com/ignacio/p/7510400.html