androidwindows-10react-nativenexus-5

React Native Dev Menu on Android Nexus 5 Device


I have a basic react-native app which I am running on a real Nexus 5 and I cannot find a way to enable the developer menu which is present for iOS and emulated devices.

https://facebook.github.io/react-native/docs/debugging.html

https://facebook.github.io/react-native/docs/running-on-device.html

Method 1: Using adb reverse (recommended)
You can use this method if your device is running Android 5.0 (Lollipop), it has USB debugging enabled, and it is connected via USB to your development machine.

Run the following in a command prompt:

$ adb reverse tcp:8081 tcp:8081 You can now use Reload JS from the React Native in-app Developer menu without any additional configuration.

When I run react-native run-android I see this line in the terminal

Running adb -s 06adb216 reverse tcp:8081 tcp:8081

But I see NO React Native in-app Developer menu

I am running:

Windows 10
react-native-cli: 2.0.1
react-native: 0.42.0

My index.android.js file looks like this:

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

AppRegistry.registerComponent('mobileapp', () => Welcome);

Solution

  • To work with android device or simulator without directly accessing hardware or click event, you can pass input to the device by adb By adb shell input keyevent, either an event_code or a string will be sent to the device.

    More information is given at Android Debug Bridge or ADB shell input

    To open menu control, please use adb shell input keyevent 82 command.

    Please let me know if you need more information on this.

    Regards, Durga