5

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);
samazi
  • 1,161
  • 12
  • 24
  • Just to be clear, also physically shaking your device doesn't bring up the menu? –  Mar 28 '17 at 13:38
  • Shaking the device does not produce a menu. I tried this a few times. I didn't think Nexus 5 supported this? – samazi Mar 28 '17 at 14:11
  • 1
    Could you please run this command `adb shell input keyevent 82` , this should work – Durgaprasad Budhwani Mar 28 '17 at 19:10
  • @DurgaprasadBudhwani that works! Brings up the menu with all expected options. If you want to write up an answer, with some info on why this works, and a link to a doc which explains this part of `adb`, I can accept it – samazi Mar 28 '17 at 23:43

1 Answers1

13

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

Community
  • 1
  • 1