Sometimes there is a need to debug application, especially Android application written in Java or Kotlin on real device. When talking about real device I mean smartphone, tablet or development kit(hardware). We should be able to access debug output using some Unix shell command. In order to do that, we need to go through the following steps:

  1. Activate USB debug mode in Android device
  2. Connect via USB Android device to computer
  3. Open terminal/command prompt and type as follows: adb tcpip 5555. This: 5555 is a port number that we are now using.
  4. Disconnect your computer from Android device
  5. Open terminal/command prompt again and type:
    • adb connect <IP_ADRESS>

This setup allows to use adb commants, for example:

  • adb shell
  • adb logcat and many others.

Reference:

  1. Apktool
  2. Reading logs with ADB: the most useful commands