【发布时间】:2016-11-01 10:26:28
【问题描述】:
我全新安装了 Sierra、Xcode 8.1,然后使用 Homebrew 安装 node、watchman、react-native-cli 等。创建了一个新的 react native 应用程序,它在“react-native run-ios”下运行良好”。
于是我安装了Android Studio,然后开始关注
https://facebook.github.io/react-native/docs/running-on-device-android.html
如果我启动一个模拟器,“react-native run-android”可以正常安装并运行,但我无法让它在设备上运行。
列表中的第一个设备是我的 Samsung Duo
$adb devices
List of devices attached
f75807c3 device
lsusb 给我连接的设备
$lsusb
Bus 020 Device 005: ID 04e8:6860 Samsung Electronics Co., Ltd. Android Serial: f75807c3
然后我需要将其输入到我的 udev 规则中才能启动和运行:
echo SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev" | sudo tee /etc/udev/rules.d/51-android-usb.rules
确保将 22b8 替换为 04e8。没有错误返回。
现在,当我使用 adb devices 检查我的设备是否正确连接到 ADB(Android 调试桥)时,我得到了相同的列表,而不是在线示例中显示的更改列表。
$adb devices
List of my devices attached
f75807c3 device
和以前一样(这里链接失败了吗??)
在设备网页上运行
List of devices attached at start of example
emulator-5554 offline # Google emulator
14ed2fcc device # Physical device
List of devices attached at end of page of example
TA9300GLMK device
我两次都得到相同的设备,只是 f75807c3 设备
当我“react-native run-android”时出现此错误
:app:installDebug 失败
FAILURE:构建失败并出现异常。
- 出了什么问题:任务 ':app:installDebug' 执行失败。
无法在任何设备上安装。
我需要做什么才能在真实设备上运行它?我在这里错过了什么?
【问题讨论】:
标签: android react-native adb