Debugging Android app with ADB command

1. First find the emulators that are active.

adb devices

2. You can specify the device ID or serial number to start debugging in a particular emulator/device, but I am considering you have only one emulator. Close other emulators or disconnect other devices if you have any extra.

3. Find the packages installed on the emulator so you can get the package name:

adb shell pm list packages

Use grep command to find the exact package name.

4. Set the app to debug at startup:

adb shell am set-debug-app -w com.sulav.carowner

Start the app on the emulator by clicking on the launcher icon. You will get a popup saying it's waiting for a debugger to be attached.

In the Android studio, go to Run -> Attach Debugger to Android Process and select the particular process.

Now if you have kept breakpoint on the code, it will stop at that point.


Popular posts from this blog

ADB Cheat Sheet

Capturing Screen of Android Device using ADB