Android Nexus 5设备上的React Native Dev菜单

sam*_*azi 5 android nexus-5 windows-10 react-native react-native-android

我有一个基本的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

但我看到没有 React Native in-app Developer菜单

我在跑步:

Windows 10
react-native-cli: 2.0.1
react-native: 0.42.0
Run Code Online (Sandbox Code Playgroud)

我的index.android.js文件看起来像这样:

import { AppRegistry } from 'react-native';
import Welcome from './src/modules/onboarding/components/welcome';

AppRegistry.registerComponent('mobileapp', () => Welcome);
Run Code Online (Sandbox Code Playgroud)

小智 11

要在没有直接访问硬件或点击事件的情况下使用Android设备或模拟器,您可以通过adb By 将输入传递给设备adb shell input keyevent,a event_code或者a string将被发送到设备.

更多信息在Android Debug BridgeADB shell输入中给出

要打开菜单控件,请使用adb shell input keyevent 82命令.

如果您需要更多相关信息,请与我们联系.

此致,杜尔加