Skip to main content
Version: 14 Oct 2024

ADB Commands

Here are some of the most frequently used ADB commands.

For instructions on how to install and use adb, follow the ADB Setup Guide.

tip

After entering the adb console with adb shell, you can quit by entering exit in the console.

Managing Apps

Installing an App

adb install <myApp.apk>
tip

You can also type adb install and then drag the apk file into the terminal window.

Reinstalling an App

To replace a previously installed version of the app:

adb install -r <myApp.apk>

Uninstalling an App

adb uninstall <package-name>
info

This is not the name of the .apk file, but the name of the app. This is typically something like com.magicleap.myapp. In Unity you can find the package name by going to the Player Settings menu. You can also run the list packages command below.

Launching an App

Though it's easiest to launch an app by simply selecting it from the Home Menu, you can also launch an app over adb:

adb shell am start -S <package-name>

Closing an App

Though it's easiest to close an app by simply hitting the [X] button on the Home Menu, you can also close an app over adb:

adb shell am force-stop <package-name>

List All Installed Packages

adb shell pm list packages

Connectivity

Pairing a Controller

To pair a controller, connect the controller to the compute pack with a USBC<->C cable. If you have to connect over ADB, this command will accept the first controller in pairing mode that the device finds.

adb shell controller connect

Connect to WiFi

Enable/Disable WiFi

# To enable wifi
adb shell wifi-ml set-wifi-enabled enabled

# To enable disable
adb shell wifi-ml set-wifi-enabled disabled

Connect to Network

adb shell wifi-ml connect-network <NETWORK-ID> wpa2 <PASSWORD> -h

Get Device IP

# Windows Powershell
adb shell ip addr show wlan0 | Select-String 'inet ' | ForEach-Object { ($_ -split ' ')[5] -split '/')[0] }

Use ADB over WiFi

adb tcpip [-p] <portnumber (any number above 1024, default is 5555)>
adb connect <IP of the Magic Leap 2>:<portnumber>
note

Will only work after WiFi has already been configured, and will last until the next reboot.

Bluetooth

Enable/Disable Bluetooth

# To enable bluetooth
adb shell settings put global bluetooth_disabled_profiles 1

# To disable bluetooth
adb shell settings put global bluetooth_disabled_profiles 0

File Management

Pushing Files to Device

adb push <file(s)-to-push> <destination-path>
tip

You can specify the destination file name as well, if you'd like the file to be renamed.

Pulling Files from Device

adb pull <file(s)-to-pull>
note

This pulls the files into the directory you're currently in. Make sure you cd to the proper directory first.

Debug/Logs

View Debug Logs (Live)

adb shell logcat | find "thing you're searching for"
adb shell logcat | find "thing you're searching for" > outputfile.txt

Show File System Usage

adb shell cmd storageusage-ml

Show Controller Info

adb shell controller info

Reset Head Pose

adb shell reset-headpose
adb shell dumpsys battery

Factory Reset

adb reboot bootloader
fastboot erase userdata
fastboot reboot

Wait For Device

Runs command after a device is detected, or omit command to just wait.

adb wait-for-device <command>

Additional Resources