Being able to run Android apps on a Chromebook is great. It gives users access to the vast Android ecosystem offerings, and it gives Android developers the opportunity to reach ChromeOS users.
ChromeOS provides Android developers with the tools to deploy and test their apps on Chromebooks. To improve users' experiences, verify your apps on different form factors.
Whether you are deploying your Android app directly from ChromeOS (using Android Studio in your Chromebook) or from another device, you can use Android Debug Bridge to deploy your app and debug different interactions with Chromebooks. For more details, see the following steps.
Enable ADB debugging
Previously, using ADB on a Chromebook was only possible while in developer mode. Since Chrome 81, developers who don't need the shell can keep their devices out of developer mode and still deploy apps they develop directly in ChromeOS. Here's how:
Go to Settings and turn on Linux, if you haven't done so already.
Once Linux is available, open the Linux settings.
Open the Develop Android apps option.
Toggle Enable ADB debugging. The Chromebook restarts.
After the Chromebook restarts, a message lets you know that there might be applications that were not downloaded from the app store on the device.
ADB is now available to deploy apps to your Chromebook, run debugging commands, and interact directly with the device.
To ensure that your Android app works well on a variety of Chromebook devices and available form factors, Google recommends that you test your app on the following devices:
- An ARM-based Chromebook
- An x86-based Chromebook
- A device with a touchscreen and one without one
- A convertible device that changes between a laptop and a tablet
- A device with a stylus
Deploy from ChromeOS
After enabling ADB debugging, you can load an Android app directly onto your ChromeOS device using Android Studio. If you have an Android Package Kit (APK) you can load it using the terminal. These options are described in the following sections.
Deploy with Android Studio
After you have set up Android Studio and ADB as described in this guide, you can push your apps to the Chromebook's Android container directly from Android Studio. The Chromebook appears as an option in the device menu:
When you push your app to a Chromebook, the ADB authorization dialog appears. After you give authorization, your application launches in a new window.
You can now deploy the app to the Chromebook and test and debug it.
Deploy with terminal
Follow these steps to deploy your app to a Chromebook using the terminal:
Install ADB if necessary, using the following command:
sudo apt install adb
Connect to the device using the following command:
adb connect arc
An authorization dialog for USB debugging appears. Grant the authorization:
Install your app from the terminal using the following command:
adb install [path to your APK]
Deploy from another device
If you can't use the preceding method and need to push your app from another device, you can connect the device to ADB using a USB connection or a network address.
Connect to ADB over a network
Follow these steps to connect to ADB over a network:
Make sure you have enabled ADB debugging.
Get the IP address of your Chromebook using the following steps:
- Click the clock in the bottom-right area of the screen.
- Click the gear icon.
- Click the network type you are connected to, such as Wi-Fi or mobile data, then the name of the network.
- Take note of the IP address.
Connect to your Chromebook:
Return to your development machine and use ADB to connect to your Chromebook using its IP address:
adb connect <ip_address>
On your Chromebook, click Allow when prompted to allow the debugger. Your ADB session is established.
Troubleshoot ADB debugging over a network
Sometimes the ADB device shows that it's offline when everything is connected properly. In this case, complete the following steps to troubleshoot the issue:
- Deactivate ADB debugging in Developer options.
- In a terminal window, run
adb kill-server
. - Re-activate the ADB debugging option.
- In a terminal window, attempt to run
adb connect
. - Click Allow when prompted to allow debugging. Your ADB session establishes.
Connect to ADB over USB
To push your APK from another device into the Chromebook, you must start your ChromeOS in developer mode so you can configure the Chromebook and push apps from the host machine.
Follow these steps to enter developer mode:
- Enable ADB debugging.
- Determine whether your device supports USB debugging.
- Press Control+Alt+T to start the ChromeOS terminal.
Type
shell
to get to the bash command shell:crosh> shell chronos@localhost / $
Type the following commands to set up your device:
$ sudo crossystem dev_enable_udc=1 $ sudo reboot
After rebooting, open the terminal again and run the following command to enable ADB on the Chromebook’s USB port:
$ sudo ectool usbpd <port number> dr_swap
Use this command each time you disconnect and reconnect a USB cable. To ensure
your Chromebook is in Upstream Facing Port (UFP) mode, you can run
ectool usbpd <port number>
.
To establish an ADB session, follow these steps:
- Plug in a USB cable to a supported port on your device.
- Run
adb devices
from the Android SDK platform tools on your host machine to see your Chromebook listed as an ADB supported device. - On your Chromebook, click Allow when prompted to allow the debugger. Your ADB session is established.