我有一个基本的 react-native
应用程序,我在真正的Nexus 5上运行,我找不到一种方法来启用 iOS
和模拟设备的开发人员菜单 .
https://facebook.github.io/react-native/docs/debugging.html
https://facebook.github.io/react-native/docs/running-on-device.html
方法1:使用adb reverse(推荐)如果您的设备运行的是Android 5.0(Lollipop),它已启用USB调试,并且通过USB连接到您的开发机器,则可以使用此方法 . 在命令提示符下运行以下命令:$ adb reverse tcp:8081 tcp:8081现在,您可以使用React Native in-app Developer菜单中的Reload JS而无需任何其他配置 .
当我运行 react-native run-android
时,我在终端看到这一行
Running adb -s 06adb216 reverse tcp:8081 tcp:8081
但我看到了 NO React Native in-app Developer菜单
我在跑步:
Windows 10
react-native-cli: 2.0.1
react-native: 0.42.0
我的 index.android.js
文件如下所示:
import { AppRegistry } from 'react-native';
import Welcome from './src/modules/onboarding/components/welcome';
AppRegistry.registerComponent('mobileapp', () => Welcome);
1 回答
要在不直接访问硬件或单击事件的情况下使用Android设备或模拟器,您可以通过
adb
adb shell input keyevent
将输入传递给设备,event_code
或string
将被发送到设备 .更多信息请参见Android Debug Bridge或ADB shell input
要打开菜单控件,请使用
adb shell input keyevent 82
命令 .如果您需要更多相关信息,请与我们联系 .
此致,杜尔加