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:
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).
Connect your Android device to your computer using a USB cable.
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).
In the terminal or command prompt, run the following command to list the connected devices:
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
- In the terminal or command prompt, run the following command to open the debugger on your device:
adb -s 5e51b22d shell input keyevent 82
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!