Configure USB Debug for Android*

If you run into difficulty setting up your device to start debugging with Remote Chrome* Development Tools (Remote CDT), please first confirm that the USB cable you're using is the right kind! Some USB cables function as charging cables, only; they do not work to transmit data. Always use a cable that supports USB data transfers!!

The Android USB debug driver must be installed on your Windows development machine before attempting any of the actions described below. Linux and OS X already have the appropriate Android USB debug drivers built-in; those OSes do not require the ADB debug driver installation step. See Installing the Android Debug Bridge (ADB) USB Driver on a Windows Computer if you do not have the ADB driver installed on your Windows machine, or if this is the first time you are going to use your Android device with this Windows computer. Keep in mind that you must go through the procedure described in the linked article for each new Android device you attach to your Windows machine.

If you are having trouble with ADB on Linux, specifically on a 64-bit Linux installation, you may need to install the 32-bit Linux shared libraries -- either the entire 32-bit support libraries, or just the libc6-i386 and lib32stdc++6 modules. On an Ubuntu/Debian system, use the sudo apt-get install libc6-i386 lib32stdc++6 command to install the required libraries.

Some Linux machines may also require configuration of udev rules before they will recognize your Android debug device over USB. See Special Instructions for Ubuntu and Other Linux Users for further detail.

Enable your Android Device for Remote Debug over USB

Confirm that your Android device is running the proper version of Android:

Remote debug can only be used with Android 4.1 and higher version devices if you are debugging an Android Crosswalk app. Android 4.4 or higher is required when debugging a non-Crosswalk (native Android) app. Android 2.x and 3.x devices do not support USB debugging.

  • Find the Settings > About device screen on your device.

  • Under Android version you will find the version of Android OS running on your device.

  • Confirm that your device is running Android 4.4 or higher for an Android app built without Crosswalk.

  • Confirm that your device is running Android 4.1 or higher for a an Android app built with Crosswalk.

Install the latest version of Intel App Preview on your Android test device:

If you plan to debug your app over USB, with the help of Intel App Preview, scan this QR code with your Android device or search for Intel App Preview in the Google Play Store.

Verify that USB debugging is enabled on your test device:

  • Find the Settings > Developer options configuration screen on your Android device.

  • If Developer options is not visible, select Settings > About device and tap the Build number seven times. Return to the Settings screen and Developer options should now be visible.

  • Enable the USB Debugging option from within Settings > Developer options. Enabling this function automatically launches remote debug mode on your Android device when a USB connection is made with your development system.

Detailed instructions regarding setting up USB debugging on your Android device can be found under the section titled Enable USB debugging on your Android device on the Remote Debugging Android Devices page from the Google Developers site.

Disconnect and reconnect the USB connection to your test device:

  • Disconnect the USB cable from your Android test device and your workstation.

  • Unlock your Android device’s home screen.

  • Reconnect the USB cable to your device and your workstation.

  • If you see an alert on your Android device requesting permission to "Allow USB debugging," click OK. On slow devices there may be a delay of five or more seconds before you see the "Allow USB debugging?" alert.

Check the "Always allow from this computer" box to avoid having to watch for this alert the next time you attach this Android device for remote USB debugging.

If you do not see the "Allow USB debugging" prompt (above) you may be able to force your Android device to show it by: 1) disabling the USB Debugging option in Settings > Developer options on your device and then 2) enabling the USB Debugging option in Settings > Developer options (that is, toggle the USB Debugging option on your Android device). Do this while your Android device is attached to your workstation via USB.

Confirm that Chrome can see your Android Device:

You can confirm that your workstation recognizes and can communicate with the Android debug bridge (adb) over USB by performing the following test with your Chrome desktop browser (this test requires Chrome):

  • Confirm that USB debugging is enabled on your Android device (see the prior instructions).

  • Close the Intel XDK and kill any adb processes that are running on your workstation (search for "kill a process" if you need help).

  • Attach your Android device to a USB port on your workstation and answer "OK" to any USB debug alert message that appears when you attach your device (see the prior instructions).

  • Open the Chrome browser on your workstation and type "chrome://inspect" into your Chrome browser’s URL bar (it is not necessary to include /#devices).

If your USB-connected Android device is recognized by Chrome it will show you the name of your device and it may also show you a list of debuggable browser tabs that are open on your Android device (see the image above). Debuggable tabs will only be listed if you have an instance of Chrome mobile browser with open tabs running on your Android device. You may also see a list of apps containing debuggable WebViews in this list (none are shown in this example screenshot above).

Something similar to the following screen will be seen if this test fails:

Important: If the above test failed, try changing the USB connection mode of your device from a Media Device (MTP) connection to a Camera Device (PTP) connection (or vice versa) and perform the Chrome test again.

See this Android USB Connections Explained article for more information about Android MTP and PTP connection modes. Some devices do not explicitly give you an "MTP" or "PTP" connection option, instead they may give you the option to "enable access to files" on your Android device; enabling "access to files" on your device is equivalent to enabling MTP mode.

Special Instructions for Ubuntu and Other Linux Users

If you're developing on Ubuntu Linux, you may need to add a udev rules file that contains a USB configuration for each Android device you want to use for USB debugging. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. For a list of vendor IDs, see USB Vendor IDs.

To set up your udev rules on Ubuntu Linux:

  1. Log in as root and create this file: /etc/udev/rules.d/51-android.rules

    Use this format to add each vendor to the file:
    SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

    In this example, the vendor ID is for HTC. The MODE assignment specifies read/write permissions, and GROUP defines which Unix group owns the device node.

    Note: The rule syntax may vary slightly depending on your Linux distribution. Consult the udev documentation for your system as needed. For an overview of the rule syntax, see this guide to writing udev rules.

  2. Now execute:
    chmod a+r /etc/udev/rules.d/51-android.rules

The details above can also be found on the Android developers doc page titled Run Apps on a Hardware Device, in the Setting up a Device for Development section of that page.

For more complete information about compiler optimizations, see our Optimization Notice.