安装步骤
- Expo 下载;
- 下载夜神模拟器,尝试过 genymotion,但是 apk 文件传输不了;
- 打开命令行,cd 到夜神模拟器目录下 /bin,查看夜神模拟器的端口(先运行夜神),用 adb 连接上夜神;
- 将 Expo 拖到模拟器上安装;
- 运行
npm run android
即可。
注意
- 出现
Error running adb: No Android device found. Please connect a device and follow t he instructions here to enable USB debugging: https://developer.android.com/studio/run/device.html#developer-device-options. I f you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK directory.
表示夜神模拟器未启动或者 adb 未连接到夜神,用adb devices
查看是否连接 - 提示
Starting: Intent { act=android.intent.action.VIEW dat=10.128.122.228:3000 pkg=com.ionicframework.myapp517087 } Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=10.128.122.228:3000 flg=0x10000000 pkg=com.ionicframework.myapp517087 }
表示模拟器未安装 Expo,需要安装。