[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Prepare the development environment\n\nBeing able to run Android apps on a Chromebook is great. It gives users access\nto the vast Android ecosystem offerings, and it gives Android developers the\nopportunity to reach ChromeOS users.\n\nChromeOS provides Android\ndevelopers with the tools to deploy and test their apps on Chromebooks.\nTo improve users' experiences, verify your apps on different form factors.\n\nWhether you are deploying your Android app directly from ChromeOS\n(using Android Studio in your Chromebook) or from another device, you\ncan use [Android Debug Bridge](https://developer.android.com/studio/command-line/adb)\nto deploy your app and debug different interactions with Chromebooks. For more\ndetails, see the following steps.\n\nEnable ADB debugging\n--------------------\n\n| **Note:** This feature is available on Chromebooks launched after 2020.\n\nPreviously, using ADB on a Chromebook was only possible while in developer\nmode. Since Chrome 81, developers who don't need the shell can keep their\ndevices out of developer mode and still deploy apps they develop directly in\nChromeOS. Here's how:\n\n1. Go to **Settings** and [turn on Linux](https://chromeos.dev/en/linux), if you haven't done so already.\n\n2. Once Linux is available, open the Linux settings.\n\n3. Open the **Develop Android apps** option.\n\n4. Toggle **Enable ADB debugging**. The Chromebook restarts.\n\n | **Note:** If the ADB toggle is not available after you enable Linux, or if it can't be toggled, you might have to factory-reset your device.\n5. After the Chromebook restarts, a message lets you know that there\n might\n be applications that were not downloaded from the app store on the device.\n\n6. ADB is now available to deploy apps to your Chromebook, run debugging\n commands, and interact directly with the device.\n\nTo ensure that your Android app works well on a variety of Chromebook devices\nand available form factors, Google recommends that you test your app on the\nfollowing devices:\n\n- An ARM-based Chromebook\n- An x86-based Chromebook\n- A device with a touchscreen and one without one\n- A convertible device that changes between a laptop and a tablet\n- A device with a stylus\n\nDeploy from ChromeOS\n--------------------\n\nAfter enabling ADB debugging, you can load an Android app directly onto your\nChromeOS device using [Android Studio](https://chromeos.dev/en/android-environment/deploying-apps#deploy-with-android-studio).\nIf you have an Android Package Kit (APK) you can load it using the terminal.\nThese options are described in the following sections.\n\n### Deploy with Android Studio\n\nAfter you have set up [Android Studio](/studio/install#chrome-os) and\nADB as described in this guide, you can push your apps to the Chromebook's Android\ncontainer directly from Android Studio.\nThe Chromebook appears as an option in the device menu:\n\nWhen you push your app to a Chromebook, the ADB authorization\ndialog appears. After you give authorization, your application launches in a new window.\n\nYou can now deploy the app to the Chromebook and test and\ndebug it.\n\n### Deploy with terminal\n\nFollow these steps to deploy your app to a Chromebook using the terminal:\n\n1. Install ADB if necessary, using the following command:\n\n sudo apt install adb\n\n2. Connect to the device using the following command:\n\n adb connect arc\n\n3. An authorization dialog for USB debugging appears. Grant the authorization:\n\n4. Install your app from the terminal using the following command:\n\n adb install [path to your APK]\n\nDeploy from another device\n--------------------------\n\nIf you can't use the preceding method and need to push your app from another\ndevice,\nyou can connect the device to ADB using a\n[USB](https://chromeos.dev/en/android-environment/deploying-apps#connect-to-adb-over-usb)\nconnection or a [network\naddress](https://chromeos.dev/en/android-environment/deploying-apps#connect-to-adb-over-a-network).\n\n### Connect to ADB over a network\n\nFollow these steps to connect to ADB over a network:\n\n1. Make sure you have [enabled ADB debugging](https://chromeos.dev/en/android-environment/deploying-apps#enable-adb-debug).\n\n2. Get the IP address of your Chromebook using the following steps:\n\n - Click the clock in the bottom-right area of the screen.\n - Click the gear icon.\n - Click the network type you are connected to, such as Wi-Fi or mobile data, then the name of the network.\n - Take note of the IP address.\n\n| **Tip:** Another quick way to find your Chromebook's IP address is to click the clock in the bottom right, then click the Wi-Fi icon, and finally click the Network info button.\n\nConnect to your Chromebook:\n\n1. Return to your development machine and use ADB to connect to your Chromebook\n using its IP address:\n\n adb connect \u003cip_address\u003e\n\n2. On your Chromebook, click **Allow** when prompted to allow the\n debugger. Your ADB session is established.\n\n#### Troubleshoot ADB debugging over a network\n\n| **Note:** If your network prohibits these kinds of connections, you can set up your own router or hotspot or you can try Ethernet using a port or dongle.\n\nSometimes the ADB device shows that it's offline when everything is connected\nproperly. In this case, complete the following steps to troubleshoot the issue:\n\n1. Deactivate **ADB debugging** in *Developer options*.\n2. In a terminal window, run `adb kill-server`.\n3. Re-activate the **ADB debugging** option.\n4. In a terminal window, attempt to run `adb connect`.\n5. Click **Allow** when prompted to allow debugging. Your ADB session establishes.\n\n### Connect to ADB over USB\n\nTo push your APK from another device into the Chromebook, you must start your\nChromeOS in [developer\nmode](https://chromium.googlesource.com/chromiumos/docs/+/HEAD/developer_mode.md)\nso you can configure the Chromebook and push apps from the host machine.\n| **Caution:** After switching your ChromeOS device to developer mode, it restarts and clears all existing data on the device. The security level of the device is also significantly reduced.\n\nFollow these steps to enter developer mode:\n\n1. [Enable ADB debugging.](#enable_adb_debug)\n2. Determine whether your device [supports USB\n debugging](https://www.chromium.org/chromium-os/chrome-os-systems-supporting-adb-debugging-over-usb).\n3. Press \u003ckbd\u003eControl\u003c/kbd\u003e+\u003ckbd\u003eAlt\u003c/kbd\u003e+\u003ckbd\u003eT\u003c/kbd\u003e to start the ChromeOS terminal.\n4. Type `shell` to get to the bash command shell:\n\n crosh\u003e shell\n chronos@localhost / $\n\n5. Type the following commands to set up your device:\n\n $ sudo crossystem dev_enable_udc=1\n $ sudo reboot\n\n6. After rebooting, open the terminal again and run the following command to\n enable ADB on the Chromebook's USB port:\n\n $ sudo ectool usbpd \u003cport number\u003e dr_swap\n\nUse this command each time you disconnect and reconnect a USB cable. To ensure\nyour Chromebook is in Upstream Facing Port (UFP) mode, you can run\n`ectool usbpd \u003cport number\u003e`.\n\nTo establish an ADB session, follow these steps:\n\n1. Plug in a USB cable to a [supported\n port](https://www.chromium.org/chromium-os/chrome-os-systems-supporting-adb-debugging-over-usb) on your device.\n2. Run `adb devices` from the Android SDK platform tools on your host machine to see your Chromebook listed as an ADB supported device.\n3. On your Chromebook, click **Allow** when prompted to allow the debugger. Your ADB session is established."]]