Tips on Android Emulator and ADB

Created on: 13 Jul 21 09:32 +0700 by Son Nguyen Hoang in English

List of crucial tips/commands when using ADB & Android emulator

When developing game for Android using Unity, adb is a must to view log and open shell for the devices.

Although the tool is very powerful, still, only a few list of commands is truly important. This post summarize them all.

  • This article is under ongoing development hence the content may be updated and changed regularly.
  1. List all devices

run adb devices from the terminal.

  1. List all packages in the devices

run adb shell pm list packages from the terminal.

  1. Error: ADB cannot find an instance of emulator device running in the system.

While an instance of BlueStack is currently running, ADB cannot find that device, and adb devices shows nothing.

Solution:

  • Run the command: adb kill-serverfirst. Then re-check the devices by adb devices. The devices should display again.
  1. Show all packages: installed in a specific, connected devices.
  • First, run adb devices to see list of connected devices. The list will show connected devices identified by name. In an emulator (like BlueStack), the name is often be emulator-5554
  • Open the shell for that device by adb -s [device-name] shell. In my device, I run adb -s emulator-5554 shell. Now, you are inside the device’s shell.
  • Show all packages by run pm list packages
  1. Enable Debug on Firebase Analytics
  • First, run adb devices to see list of connected devices. The list will show connected devices identified by name. In an emulator (like BlueStack), the name is often be emulator-5554
  • Open the shell for that device by adb -s [device-name] shell. In my device, I run adb -s emulator-5554 shell. Now, you are inside the device’s shell.
  • Show all packages by run pm list packages
  • Enable the debug by run setprop debug.firebase.analytics.app <package_name>
  • On Firebase, Check the Debug View
  1. Wireless Debugging
  • Enable Wireless Debugging from Android Machine
  • Tap on the “Wireless Debugging” to open the menu (on Android)
  • Select option to pair devices by 6-digit. A new popup will show up, that include an address IP:PORT_PAIR and 6 digit (this is the code)
  • From the computer, run adb pair IP:PORT_PAIR. Then a prompt will appear and ask for the code. Enter the code.
  • If the code is correct, run adb connect IP:PORT_CONNECT.

Note that the port used for pairing and connecting are two different things. PORT_CONNECT is the first port address you see when open the menu Wireless Debugging, while PORT_PAIR is only used for pairing and showned only when asked to pair devices.

Back To Top