Run Apps On A Hardware Device - Android Developers

Skip to main content Android Developers Essentials
  • Build AI experiences
  • Build AI-powered Android apps with Gemini APIs and more.
  • Get started
  • Get started
  • Start by creating your first app. Go deeper with our training courses or explore app development on your own.
  • Hello world
  • Training courses
  • Tutorials
  • Compose for teams
  • Kotlin for Android
  • Monetization with Play ↗️
  • Android Developer Verification
  • Extend by device
  • Build apps that give your users seamless experiences from phones to tablets, watches, headsets, and more.
  • Adaptive apps
  • Android XR
  • Wear OS
  • Android for Cars
  • Android TV
  • ChromeOS
  • Build by category
  • Learn to build for your use case by following Google's prescriptive and opinionated guidance.
  • Games
  • Camera & media
  • Social & messaging
  • Health & fitness
  • Productivity
  • Enterprise apps
  • Get the latest
  • Stay in touch with the latest releases throughout the year, join our preview programs, and give us your feedback.
  • Latest updates
  • Experimental updates
  • Android Studio preview
  • Jetpack & Compose libraries
  • Wear OS releases
  • Privacy Sandbox ↗️
Design & Plan
  • Excellent Experiences
  • Build the best experiences for your best users.
  • Learn more
  • UI Design
  • Design a beautiful user interface using Android best practices.
  • Design for Android
  • Mobile
  • Adaptive UI
  • XR Headsets & XR Glasses
  • AI Glasses
  • Widgets
  • Wear OS
  • Android TV
  • Android for Cars
  • Architecture
  • Design robust, testable, and maintainable app logic and services.
  • Introduction
  • Libraries
  • Navigation
  • Modularization
  • Testing
  • Kotlin Multiplatform
  • Quality
  • Plan for app quality and align with Play store guidelines.
  • Overview
  • Core value
  • User experience
  • Accessibility
  • Technical quality
  • Excellent Experiences
  • Security
  • Safeguard users against threats and ensure a secure Android experience.
  • Overview
  • Privacy
  • Permissions
  • Identity
  • Fraud prevention
Develop
  • Gemini in Android Studio
  • Your AI development companion for Android development.
  • Learn more
  • Get Android Studio
  • Core areas
  • Get the samples and docs for the features you need.
  • Samples
  • User interfaces
  • Background work
  • Data and files
  • Connectivity
  • All core areas ⤵️
  • Tools and workflow
  • Use the IDE to write and build your app, or create your own pipeline.
  • Write and debug code
  • Build projects
  • Test your app
  • Performance
  • Command-line tools
  • Gradle plugin API
  • Device tech
  • Write code for form factors. Connect devices and share data.
  • Adaptive UI
  • Wear OS
  • Android XR
  • Android Health
  • Android for Cars
  • Android TV
  • All devices ⤵️
  • Libraries
  • Browse API reference documentation with all the details.
  • Android platform
  • Jetpack libraries
  • Compose libraries
  • Google Play services ↗️
  • Google Play SDK index ↗️
Google Play
  • Play Console
  • Publish your app or game and grow your business on Google Play.
  • Go to Play Console
  • Learn more ↗️
  • Fundamentals
  • Learn how to engage users, monitize, and secure your app.
  • Play Monetization
  • Play Integrity
  • Play Policies
  • Play Programs ↗️
  • Games Dev Center
  • Develop and deliver games. Get tools, downloads, and samples.
  • Overview
  • Play Asset Delivery
  • Play Games Services
  • Play Games on PC
  • All Play guides ⤵️
  • Libraries
  • Browse API reference documentation with all the details.
  • Play Feature Delivery
  • Play In-app Updates
  • Play In-app Reviews
  • Play Install Referrer
  • Google Play services ↗️
  • Google Play SDK index ↗️
  • All Play libraries ⤵️
  • Tools & resources
  • Tools for publishing, promoting, and managing your app.
  • Android App Bundles
  • Brand & marketing
  • Play Console APIs ↗️
Community /
  • English
  • Deutsch
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Polski
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어
Android Studio
  • Android Studio
Download IDE guides Gemini in Android Studio Android Studio preview Gradle build guides SDK tools guides Android Developers
  • Essentials
    • More
  • Design & Plan
    • More
  • Develop
    • More
    • Download
    • IDE guides
    • Gemini in Android Studio
    • Android Studio preview
    • Gradle build guides
    • SDK tools guides
  • Google Play
    • More
  • Community
  • Android Studio
  • What's new in Android Studio
    • Android Studio Panda 2 release notes
    • Android Emulator release notes
    • Past Android Studio releases
    • Android Studio release names
    • Service integrations
      • Overview
      • Deprecated service integrations
  • Get started with Android Studio
    • Overview
    • Install Android Studio
    • New UI in Android Studio
    • Get to know the UI
      • Overview
      • Accessibility features
      • Keyboard shortcuts
    • Workflow basics
  • Manage your project
    • Overview
    • Create a project
    • Migrate to Android Studio
    • Version control basics
    • Configure the IDE
    • Update the IDE and tools
    • About Play Feature Delivery
    • Add C and C++ code
      • Overview
      • Install NDK and CMake
      • Configure the NDK for AGP
      • Configure CMake
      • Link Gradle
    • Create an Android library
    • Set up continuous integration
  • Write your code
    • Write your code quicker and more efficiently
    • Work with templates
      • Add code from a template
      • Find sample code
      • Create a Java class or type
    • Add a module for a new device
    • Use Java 8 language features
    • Java 8 language support table
    • Add app resources
    • Use tools to develop UI
      • Develop a layout with Compose ⍈
      • Develop a layout with Views
      • Create animations with Compose ⍈
      • Manage UI resources
      • Add multi-density vector graphics
      • Create app icons
      • Create resizable bitmaps (9-patch)
      • Create WebP images
      • Localize the UI
    • Add Android app links
    • Connect to Firebase
    • Improve your code with lint checks
    • Improve code inspection with annotations
    • Tools attributes reference
  • Run and debug your app
    • Overview
    • Run your app on virtual devices
      • Create and manage virtual devices
      • Run your app with Android Emulator
        • Overview
        • Test on multiple screen sizes
        • Take screenshots
        • Record the screen
        • Use the camera
        • Launch in a separate window
        • Launch without running an app
        • Install and add files
        • Use WiFi
        • Use advanced Android Emulator features
          • Use extended controls
          • Use snapshots
          • Use the emulator from the command line
          • Send console commands
          • Set up networking
          • Configure hardware acceleration
          • Emulator feature comparison
        • Troubleshoot emulator
    • Android Device Streaming
    • Run your app on a local device
      • Get started
      • Install OEM USB drivers
      • Get the Google USB driver
    • Debug your code
      • Get started debugging your code
      • Configure developer options
      • Write and view logs
      • Analyze and address crash issues
        • Analyze a stack trace
        • Analyze Crashlytics and Vitals reports
      • Debug your layout
      • View design issues
      • Inspect network traffic
      • Debug your database
      • Debug your WorkManager Workers
      • View on-device files
      • Debug pre-built APKs
      • Take a screenshot
      • Record a video
      • Capture and read bug reports
      • Analyze your APK or AAB
    • Customize run/debug configurations
  • Test your code
    • Choose a testing method
    • Test in Android Studio
    • Test with build-managed devices
    • Test against screen changes
    • Test from the command line
    • Set up advanced test configurations
    • Use specialized testing tools
      • Create UI tests
      • Set up automatic testing of your code
      • Stress-test your code with user events
  • Inspect performance issues
    • Overview
    • Record a system trace
      • Overview
      • Inspect traces
      • Detect UI jank
      • Inspect power usage
      • Generate trace logs
    • Capture a heap dump
    • Sample the callstack
    • Record Java/Kotlin allocations
    • Record Java/Kotlin methods
    • Record native allocations
    • Inspect your app live
    • Inspect pre-built APKs
    • Run the standalone profiler
    • Build and run a profileable app manually
    • Chart glossary
      • Call chart
      • Events table
      • Flame chart
      • Process memory (RSS)
      • Top down and bottom up charts
  • Publish your app
    • Overview
    • Play Policy Insights
    • Prepare for release
    • Version your app
    • Sign your app
    • Upload your app
  • Troubleshoot
  • Known issues
  • Report a bug
  • Android Developers
  • Develop
  • Android Studio
  • IDE guides
Run apps on a hardware device Stay organized with collections Save and categorize content based on your preferences.

Always test your Android 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 over an Android Debug Bridge (ADB) connection.

Note: Use the Android Emulator to test your app on different versions of the Android platform and different screen sizes. Consider using Firebase Test Lab to run your app on a wide variety of real devices hosted in a cloud-based infrastructure.

Set up a device for development

Before you can start debugging on your device, decide whether you want to connect to the device using a USB cable or Wi-Fi. Then do the following:

  1. On the device, open the Settings app, select Developer options, and then enable USB debugging (if applicable).

    Note: If you don't see Developer options, follow the instructions to enable developer options.
  2. Set up your system to detect your device.

    • ChromeOS: No additional configuration required.
    • macOS: No additional configuration required.
    • Windows: Install a USB driver for ADB (if applicable). For an installation guide and links to OEM drivers, see Install OEM USB drivers.
    • Ubuntu Linux: Set up the following:

      • Each user that wants to use ADB needs to be in the plugdev group. If you see an error message that says you're not in the plugdev group, add yourself to it using the following command:
      sudo usermod -aG plugdev $LOGNAME

      Groups only update on login, so you must log out for this change to take effect. When you log back in, you can use id to check that you're in the plugdev group.

      • The system needs to have udev rules installed that cover the device. The android-sdk-platform-tools-common package contains a community-maintained default set of udev rules for Android devices. To install it, use the following command:
      apt-get install android-sdk-platform-tools-common

Connect to your device using USB

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

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

  • Verify that your device is connected by running the adb devices command from your android_sdk/platform-tools/ directory. If connected, you'll see the device listed.
  • Issue any adb command with the -d flag to target your device.

Connect to your device using Wi-Fi

Android 11 and higher supports deploying and debugging your app wirelessly from your workstation via Android Debug Bridge (ADB). For example, you can deploy your debuggable app to multiple remote devices without physically connecting your device via USB and contending with common USB connection issues, such as driver installation.

To use wireless debugging, you need to pair your device to your workstation using a pairing code. To begin, complete the following steps:

  1. Ensure that your workstation and device are connected to the same wireless network.
  2. Ensure that your device is running Android 11 or higher. For more information, see Check & update your Android version.
  3. Ensure that you have the latest version of Android Studio installed. Download it here.
  4. On your workstation, update to the latest version of the SDK Platform Tools.

To connect to your device, follow these steps:

  1. Open Android Studio and select Pair Devices Using Wi-Fi from the run configurations menu.
    Run configurations drop-down
    Figure 1. Run configurations menu.
    The Pair devices over Wi-Fi dialog appears, as shown in figure 2.
    Screenshot of the pair devices over Wi-Fi popup window
    Figure 2. Dialog to pair devices using QR code or pairing code.
  2. Enable developer options on your device.
  3. Enable debugging over Wi-Fi on your device.
    Screenshot of a pixel phone showing the Wireless debugging       systems setting.
    Figure 3. The Wireless debugging setting on a Google Pixel phone.
  4. Tap Wireless debugging and pair your device:
    1. To pair your device with a QR code, select Pair device with QR code and scan the QR code, shown in figure 2.
    2. To pair your device with a pairing code, select Pair device with pairing code from the Pair new devices over Wi-Fi dialog. On your device, select Pair using pairing code. A six-digit code appears. Once your device appears on the Pair devices over Wi-Fi window, enter the six-digit code shown on your device and select Pair .
      Screenshot of example pairing code entry
      Figure 4. Example of six-digit pairing code entry.
  5. After pairing, you can attempt to deploy your app to your device.

To pair a different device or to forget this device on your workstation:

  1. Navigate to Wireless debugging on your device.
  2. Tap your workstation name under Paired devices.
  3. Select Forget.

Device mirroring

You can mirror your physical device in the Running Devices window in Android Studio. By streaming your device's display directly to Android Studio, you can use the Studio IDE itself to execute common actions such as starting apps and interacting with them, rotating the screen, folding and unfolding the phone, and changing the volume.

Device mirroring is always available when there are devices connected to the computer that have USB or wireless debugging enabled. You can start and stop mirroring using the Running Devices window or the Device Manager (View > Tool Windows > Device Manager). You can also customize when device mirroring is activated in its settings (Settings > Tools > Device Mirroring).

Note: If you're using certain devices, for example the Xiaomi Redmi K40, Poco F3, or Mi 11X, with Android 12, you must enable both the USB debugging and USB debugging (Security settings) settings and then restart the device to enable device mirroring.

Running Devices UI

Redirect audio

When you're using device mirroring, you can redirect audio from connected physical devices to your computer speakers or headphones. With audio redirection, keep your headphones connected to your computer and listen to both the computer and connected phone without having to manually reconnect to one device and then another. To enable audio redirection, go to File (Android Studio on macOS) > Settings > Tools > Device Mirroring and select Redirect audio from local devices. Note that audio is always redirected, regardless of the settings, for Firebase Test Lab devices running Android 12 or higher.

Known issues

Some devices might not be capable of encoding at a bitrate sufficient to support device mirroring. In these situations, you might see an error in the Running Devices window as well as logs similar to the following.

2023-06-01 15:32:22,675 [ 56094] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - Too many video encoder errors: 2023-06-01 15:32:22,676 [ 56095] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - encoder: c2.android.vp8.encoder 2023-06-01 15:32:22,676 [ 56095] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - mime type: video/x-vnd.on2.vp8 2023-06-01 15:32:22,676 [ 56095] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - max resolution: 640x640 2023-06-01 15:32:22,676 [ 56095] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - min resolution: 2x2 2023-06-01 15:32:22,676 [ 56095] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - alignment: 2x2 2023-06-01 15:32:22,676 [ 56095] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - max frame rate: 960 2023-06-01 15:32:22,676 [ 56095] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - max frame rate for 288x640: 960 2023-06-01 15:32:22,870 [ 56289] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - max bitrate: 20000000 2023-06-01 15:32:22,871 [ 56290] WARN - ScreenSharingAgent Samsung SM-A045F API 33 - terminated with code 1

Privacy notice

Based on the device mirroring settings, Android Studio can automatically start device mirroring for any connected and paired device. This might result in information disclosure for devices connected with the adb tcpip command because the mirroring information and commands are passed over a non-encrypted channel. In addition, Android Studio uses a non-encrypted channel to communicate with the adb server, so mirroring information can be intercepted by other users on your host machine.

Troubleshoot device connection

If your device is not connecting to Android Studio, try the following steps to resolve the issue:

Troubleshoot with the Connection Assistant

The Connection Assistant provides step-by-step instructions to help you set up and use a device over the ADB connection.

To start the assistant, choose Tools > Troubleshoot Device Connections.

The Connection Assistant provides instructions, in-context controls, and a list of connected devices in a series of pages in the Assistant panel. Use the Next and Previous buttons at the bottom of the Assistant panel to work through the pages as needed:

  • Connect your device over USB: The Connection Assistant first prompts you to connect your device over USB and provides a Rescan USB devices button where you can start a new scan for connected devices.
  • Enable USB debugging: The Connection Assistant then tells you how to enable USB debugging in the on-device developer options.
  • Restart the ADB server: If you still don't see your device on the list of available devices, use the Restart ADB server button on the last page of the Connection Assistant. Restarting the ADB server also causes ADB to scan for devices again. If you still don't see your device on the list of available devices, try the troubleshooting steps in the following section.

Resolve USB connection issues

If the Connection Assistant doesn't detect your device over USB, try the following troubleshooting steps to resolve the issue:

Check that Android Studio connects to the Android Emulator

To check whether the issue is being caused by a connection problem between Android Studio and the Android Emulator, follow these steps:

  1. Open the Device Manager.
  2. Create a new AVD if you don't already have one.
  3. Run the emulator using your AVD.
  4. Do one of the following:
    • If Android Studio can't connect to the emulator, download the latest SDK Platform Tools and then try again.
    • If the emulator starts successfully, check the USB cable as described in the following section.

Check the USB cable

To check whether the issue is being caused by a faulty USB cable, follow the steps in this section.

If you have another USB cable:

  1. Connect the device using the secondary cable.
  2. Check whether the Connection Assistant can now detect the device.
  3. If the device is not detected, try the primary cable again.
  4. If the device still isn't detected, assume that the problem is with the device, and check whether the device is set up for development as described in the following section.

If you don't have another USB cable but you do have another Android device:

  1. Connect the secondary device to your computer.
  2. If the Connection Assistant can detect the secondary device, assume that the problem is with the primary device, and check whether the device is set up for development.

    If the secondary device is not detected, the problem might be with the USB cable.

Check whether the device is set up for development

To check whether the issue is being caused by settings on the device, follow these steps:

  1. Follow the steps in the Set up a device for development section.
  2. If this doesn't resolve the problem, contact the device OEM's customer support for help. Tell the customer support representative that the device doesn't connect to Android Studio using ADB.

Resolve wireless connection issues

If you are having issues connecting to your device wirelessly, you can try the following troubleshooting steps to resolve the issue:

Check whether your workstation and device meet the prerequisites

To meet the prerequisites for wireless debugging, ensure that:

  • Your workstation and device are connected to the same wireless network.
  • Your device is running Android 11 or higher. For more information, see Check & update your Android version.
  • You have the latest version of Android Studio. You can download it from the main Android Studio page.
  • You have the latest version of the SDK Platform Tools on your workstation.

Check for other known issues

The following is a list of current known issues with wireless debugging in Android Studio and how to resolve them:

  • Wi-Fi is not connecting: Some Wi-Fi networks, such as corporate Wi-Fi networks, may block p2p connections and not let you connect over Wi-Fi. Try connecting with a cable or another Wi-Fi network.
  • ADB over Wi-Fi sometimes turns off automatically: This can happen if the device either switches Wi-Fi networks or disconnects from the network.

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 USB debugging and other adb commands can't be executed unless you're able to unlock the device and acknowledge the dialog.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-26 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-02-26 UTC."],[],[]]
  • X X Follow @AndroidDev on X
  • YouTube YouTube Check out Android Developers on YouTube
  • LinkedIn LinkedIn Connect with the Android Developers community on LinkedIn
  • More Android

    • Android
    • Android for Enterprise
    • Security
    • Source
    • News
    • Blog
    • Podcasts
  • Discover

    • Gaming
    • Machine Learning
    • Health & Fitness
    • Camera & Media
    • Privacy
    • 5G
  • Android Devices

    • Large screens
    • Wear OS
    • ChromeOS devices
    • Android for cars
    • Android TV
  • Releases

    • Android 15
    • Android 14
    • Android 13
    • Android 12
    • Android 11
    • Android 10
    • Pie
  • Documentation and Downloads

    • Android Studio guide
    • Developers guides
    • API reference
    • Download Studio
    • Android NDK
  • Support

    • Report platform bug
    • Report documentation bug
    • Google Play support
    • Join research studies
Google Developers
  • Android
  • Chrome
  • Firebase
  • Google Cloud Platform
  • All products
  • Privacy
  • License
  • Brand guidelines
  • Manage cookies
  • Get news and tips by email Subscribe
  • English
  • Deutsch
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Polski
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어

Tag » App To Phone