On this Page
This guide describes how to perform common tasks using adb.
Android Debug Bridge (adb) is included in the Android SDK and is the main tool used to communicate with an Android device for debugging. We recommend familiarizing yourself with it by reading the official documentation located here: http://developer.android.com/tools/help/adb.html
For a list of available commands and options, make a connection as described below and enter:
Using adb from the OS shell, it is possible to connect to and communicate with an Android device either directly through USB, or via TCP/IP over a Wi-Fi connection. You must install the Android SDK and appropriate device drivers to use adb (see Device Setup - Oculus Go).
To connect a device via USB, plug the device into the PC with a compatible USB cable. After connecting, open up an OS shell and type:
If the device is connected properly, adb will show the device id list such as:
List of devices attached ce0551e7 device
Adb may not be used if no device is detected. If your device is not listed, the most likely problem is that you do not have the correct USB driver (see Device Setup - Oculus Go for more information). You may also wish to try another USB cable and/or port.
Connecting to a device via USB is generally faster than using a TCP/IP connection, but a TCP/IP connection is sometimes indispensable.
To connect via TCP/IP, first make sure the device is already connected via USB, and then use this command to determine its IP address:
adb shell ip route
The output should look something like this:
10.0.30.0/19 dev wlan0 proto kernel scope link src 10.0.32.101
The IP address of the device follows
src. Using the IP address and port (generally 5555), issue the following commands:
adb tcpip <port> adb connect <ipaddress>:<port>
> adb tcpip 5555 restarting in TCP mode port: 5555 > adb connect 10.0.32.101:5555 connected to 10.0.32.101:5555
The device can now be disconnected from the USB port. As long as
adb devices shows only a single device, all adb commands will be issued for the device via Wi-Fi.
To stop using the Wi-Fi connection, issue the following adb command from the OS shell:
To install an APK on your mobile device using adb, connect to the target device and verify connection using adb devices as described above. Then install the APK with the following command:
adb install <apk-path>
-r option to overwrite an existing APK of the same name already installed on the target device. For example:
adb install -r C:\Dev\Android\MyProject\VrApp.apk
For more information, see the Installing an Application section of Android’s Android Debug Bridge guide.
Note that depending on the particular device, detection may be finicky from time to time. In particular, on some devices, connecting while a VR app is running or when adb is waiting for a device may prevent the device from being reliably detected. In those cases, try ending the app and stopping adb using Ctrl-C before reconnecting the device. Alternatively, the adb service can be stopped using the following command, after which the adb service will automatically be restarted when executing the next command:
Multiple devices may be attached at once, and this is often valuable for debugging client/server applications. Be aware that when the same device is simultaneously connected by Wi-Fi and USB, adb will show the device as two devices. When there are multiple listed devices, adb must be told which device to target using the
-s switch. For example, consider if
adb devices showed the following:
List of devices attached ce0551e7 device 10.0.32.101:5555 device
The listed devices could be two separate devices, or one device that is connected both via Wi-Fi and plugged into USB (perhaps to charge the battery). In this case, all adb commands must take the following form, where <device id> is the identifier reported by
adb -s <device id> <command>
For example, to issue a logcat command to the device connected via TCP/IP:
adb -s 10.0.32.101:55555 logcat -c
To issue the same command to the device connected via USB:
adb -s ce0551e7