The development environment

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 can keep their devices out of developer mode and still deploy apps they develop directly in ChromeOS. Here is how:

  1. Make sure the Chromebook is not in developer mode.
  2. Go to Settings and turn on Linux, if you haven't done so before.

  3. Once Linux is available, open the Linux settings.

  4. Open the Develop Android apps option.

  5. Toggle Enable ADB debugging. The Chromebook restarts.

  6. 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.

  7. 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:

  1. Install ADB if necessary, using the following command:

    sudo apt install adb
    
  2. Connect to the device using the following command:

    adb connect arc
    
  3. An authorization dialog for USB debugging appears. Grant the authorization:

  4. 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:

  1. Make sure you have enabled ADB debugging.

  2. 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:

  1. Return to your development machine and use ADB to connect to your Chromebook using its IP address:

    adb connect <ip_address>
    
  2. 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:

  1. Deactivate ADB debugging in Developer options.
  2. In a terminal window, run adb kill-server.
  3. Re-activate the ADB debugging option.
  4. In a terminal window, attempt to run adb connect.
  5. 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:

  1. Enable ADB debugging.
  2. Determine whether your device supports USB debugging.
  3. Press Control+Alt+T to start the ChromeOS terminal.
  4. Type shell to get to the bash command shell:

    crosh> shell
    chronos@localhost / $
    
  5. Type the following commands to set up your device:

    $ sudo crossystem dev_enable_udc=1
    $ sudo reboot
    
  6. 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:

  1. Plug in a USB cable to a supported port on your device.
  2. Run adb devices from the Android SDK platform tools on your host machine to see your Chromebook listed as an ADB supported device.
  3. On your Chromebook, click Allow when prompted to allow the debugger. Your ADB session is established.