Skip to content

Most visited

Recently visited

navigation

Run Apps on a Hardware Device

When building an Android app, it's important that you always test your app on a real device before releasing it to users. This page describes how to set up your development environment and Android device for testing and debugging.

Set up a device for development

Before you can start debugging on your device, there are a few things you must do:

  1. On the device, open the Settings app, select Developer options, and then enable USB debugging.
  2. Set up your system to detect your device.
    • Windows: Install a USB driver for Android Debug Bridge (adb). For an installation guide and links to OEM drivers, see the Install OEM USB Drivers document.
    • Mac OS X: It just works. Skip this step.
    • Ubuntu Linux: Use apt-get install to install the android-tools-adb package. This gives you a community-maintained default set of udev rules for all Android devices.

      Make sure that you are in the plugdev group. If you see the following error message, adb did not find you in the plugdev group:

      error: insufficient permissions for device: udev requires plugdev group membership

      Use id to see what groups you are in. Use sudo usermod -aG plugdev $LOGNAME to add yourself to the plugdev group.

      The following example shows how to install the Android adb tools package.

      apt-get install android-tools-adb

Connect to your device

When you are set up and plugged in over USB, you can click Run in Android Studio to build and run your app on the device.

You can also use adb to issue commands, as follows:

RSA security key

When you connect a device running Android 4.2.2 (API level 17) or higher to your computer, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)