DEV Community

Cover image for Open the React Native debugger on Android without shaking.
Nomanoff
Nomanoff

Posted on

Open the React Native debugger on Android without shaking.

So, I am sitting in a class with a bunch of students and I wanna try to code my app. However, every time I want to debug I have to shake the phone which is weird during class time so I had to research how to open the debugger without shaking.

Here is how:

  1. First, make sure you have the adb tool installed on your computer. If you don't have it, you can download and install it as part of the Android SDK (see https://developer.android.com/studio/command-line/adb for more information).

  2. Connect your Android device to your computer using a USB cable.

  3. Open a terminal or command prompt on your computer, and navigate to the directory where the adb tool is installed (usually something like C:\Users\username\AppData\Local\Android\Sdk\platform-tools on Windows, or ~/Library/Android/sdk/platform-tools on macOS).

  4. In the terminal or command prompt, run the following command to list the connected devices:

adb devices

Enter fullscreen mode Exit fullscreen mode

This command should output a list of the connected devices, including your Android device. The output should look something like this:

List of devices attached
emulator-5554   device
5e51b22d    device

Enter fullscreen mode Exit fullscreen mode
  1. In the terminal or command prompt, run the following command to open the debugger on your device:
adb -s 5e51b22d shell input keyevent 82

Enter fullscreen mode Exit fullscreen mode

Replace 5e51b22d with the actual device ID of your Android device from the output of the adb devices command. This command will send a key event to the device with the code 82, which is the code for the "menu" key. On most Android devices, this will open the debugger tool.

Alternatively, instead of using the adb tool, you can also use the React Native Debugger app (https://github.com/jhen0409/react-native-debugger) to open the debugger on your device. This app provides a button that you can press to open the debugger, so you don't have to use the adb tool or shake the phone.

I hope this helps! Thanks!

Top comments (2)

Collapse
 
naucode profile image
Al - Naucode

Hey, it was a nice read, you got my follow, keep writing!

Collapse
 
nomanoff_tech profile image
Nomanoff

thank you