Sometimes there is a need to debug applications, especially Android applications written in Java or Kotlin on a real device. When talking about real devices 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:
- Activate USB debug mode in Android device
- Connect via USB Android device to computer
- Open terminal/command prompt and type as follows:
adb tcpip 5555. This:
5555is a port number that we are now using.
- Disconnect your computer from Android device
- Open terminal/command prompt again and type:
adb connect <IP_ADRESS>
This setup allows to use adb commants, for example:
adb logcatand many others.