Remote Debugging Android Devices
Remotely debug your Android device on your computer
byKayce Basques Technical Writer at Google
bymeggin Kearney Meggin is a Tech Writer
Remote Debug Live content on a Android device from your Windows, MAC, or Linux computer. //Remote real-Time debugging of Android device content.
Tl;dr
- Set up your Android device for remote debugging, and discover it from your development machine.
- Inspect and debug live content on your Android device from your development.
- Screencast content from your Android device to DevTools.
Requirements
To begin remote debugging, you need:
- Chrome or later installed on your development. //Chrome browser with Android version number 32 or higher on your computer.
- USB drivers installed on your development machine, if you ' re using Windows. (Ensure Device Manager reports the USB driver correctly) //The USB driver for Android device is installed on the computer.
- A USB cable to connect your Android device to your development machine. //Connect your Android device and computer with a USB cable.
- Android 4.0 or later. //Android version 4.0 or higher.
- Chrome for Android installed on your Android device. //install chrome on your Android device.
Enable USB Debugging on your Android device
On your Android device, open up Settings, find the Developer options section, and enable USB Debuggi Ng. If you're running Android 4.2 or later and you can ' t find Developer options , you could need to enable it. //Open the developer options for Android devices.
Connect and discover your Android device
On your development machine, open Chrome. You should is logged in to one of your user profiles. Remote debugging does not work in Incognito or guest mode. //Press F12 to enter the developer tools interface, then click on the three dot pattern menu-->more tools-->inspect devices.
Open DevTools and select more tools > Inspect devices.
From this can see the status of all connected remote devices. You don ' t has any devices connected right now, so your dialog should look similar to the following screenshot. Make sure thisDiscover USB devices is enabled. //Make sure to check the Discover USB devices.
Connect your Android device to your development machine using a USB cable. You should connect your Android device directly to your development machine, not through any intermediate hubs.
If This is your first time connecting this Android device to this development machine, you should see an unknown device th At are pending authorization on your Inspect Devices dialog.
If This is the case, then you need to open the Allow USB debugging prompt on your Android device and grant the PE Rmissions.
Tip: If you had encounter any issues during the discovery process, you can start the process anew by going back To Developer options and tapping Revoke USB debugging authorizations.
After allowing USB debugging, you should see your device in the Inspect Devices dialog.
Debug content on Android device from development machine
From the Inspect Devices dialog, select your device from the menu on the left.
From this can see a variety of information about your connected Andoid device:
- At the top of your can see the model name of your Android device followed by it serial number (for example,
Nexus 5 #08ae8c2700f43a61
).
- If one or more chrome tabs is open, then you'll see a Chrome heading followed by the version number of chrome th At ' s running (for example,
Chrome (49.0.2623.105)
). If No chrome tabs is open, you won ' t see a chrome heading.
- Underneath the Chrome heading, each open tab gets its own heading. You can interact.
- If There is any running apps using the WebView, you'll see a heading for each app.
To open a new Chrome tab, enter a URL of the TextField under the Chrome heading and then clickOpen. A new tab automatically opens and loads the specified URL.
To reload, focus, or close a open tab, click the more options icon next to the inspect button.
To open up DevTools on your development machine and inspect or debug the live content on your Android device, click the inspect button next to the tab, want to investigate. A new instance of DevTools opens up in your development machine.
Note: The version of Chrome on your Android device determines the version of DevTools on your development machine used during remote debugging. So, the DevTools window in your development machine may look different than what you ' re used to.
When you hover over or select a element in the Elements panel, which element is highlighted on your Android Devic E.
You can also tap on your Android device screens to select an element. First, click on the Select Element () button in DevTools, and then tap on your Android device screen. The element is selected in the Elements panel of DevTools. Note that the Select element button is automatically disabled after the first touch, so you need to re-enable it Every time, want to use this feature.
Screencast from Android device to development machine
Enable the Toggle screencast button () to view a screencast of the content on your Android device from within R DevTools window.
Screencasts only display page content. Transparent portions of the screencast represent device interfaces, such as the Chrome Omnibox, the Android status bar, or The Android keyboard.
Note: screencasts continuously capture frames, so you should disable your screencast if your test are sensitive to Frame rates.
You can interact with the screencast in multiple ways:
- Clicks is translated into taps, firing proper touch events on the device.
- Keystrokes on your computer is sent to the device.
- To simulate a pinch gesture, hold while Shift dragging.
- To scroll, use your trackpad or mouse wheel, or fling with your mouse pointer.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and Co De samples is licensed under the Apache 2.0 License. For details, see our Site policies. Java is a registered trademark of the Oracle and/or its affiliates.
Last updated: November 16, 2016
Remote debugging Android Devices