Debug React Native Apps like a PRO
Small steps to debug your crashing Android app without error logs
As a mobile developer, it’s not uncommon that your app will crash or freeze once in a while without any specific reasons. Debugging the .apk file can cause many headaches since you won’t have your remote debugger connected and sometimes no error logs at all.
Android Debug Bridge
ADB is a command-line tool that lets developers an alternative way to communicate with a device. It provides us a way of installing and debugging apps via terminal.
It’s consist of client-server architecture, which holds three main components:
- client: running on your machine and sending commands
- daemon (adbd) runs commands on a smartphone device
- server controls communication between the adbd and the client
adb is pre-included in the SDK Platform-Tools package for Android.
Installation
In case you have a crashing .apk file that doesn’t show any errors, you can use ADB command to install the app via the terminal.
- Make sure your simulator is up and running.
- Navigate to the same folder as your .apk file and execute the command:
adb install myAppName.apk
In case your app has any errors, you’ll see them now.
Reloading
In case your app freezes and the physically shaking device doesn’t work, there is a command that will help you reload the app from the command line.
adb shell input text "RR"
ADB provides us access to a Unix shell that can run various commands on a device. This command tells the device to type “RR” which is the React Native command for reloading.
These are the most common and helpful ADB commands, but there are many others that you can use to level up your Android development.