function updateAndroidMarketLinks() { var ua = navigator.userAgent.toLowerCase(); if (0 <= ua.indexOf("android")) { // we have android $("a[href^='http://market.android.com/']").each(function() { this.href = this.href.replace(/^http:\/\/market\.android\.com\//, "market://"); }); } } }); </script>
The way your web content behaves on mobile can be dramatically different from the desktop experience. Remote debugging with Chrome DevTools lets you debug live content on your Android device from your development machine.
Note: Remote debugging requires your version of desktop Chrome to be newer than the version of Chrome for Android on your device. For best results, useChrome Canary(Mac/Windows) or the ChromeDev channelrelease (Linux) on desktop.
If at any time you encounter problems with remote debugging, refer to theTroubleshootingsection.
Setting up your Android device
Follow these instructions to set up your Android device for remote debugging.
1. Enable USB debugging
On your Android device, selectSettings > Developer options.
Note: OnAndroid 4.2and later, the developer options are hidden by default. To enable the developer options, selectSettings > About phoneand tapBuild numberseven times.
An alert prompts you to allow USB debugging. TapOK.
2. Connect your device
Connect the Android device to your development machine using a USB cable.
Note: If you are developing onWindows, install the appropriate USB driver for your device. SeeOEM USB Driverson the Android Developers' site.
Discovering devices in Chrome
After setting up remote debugging on Android, discover your device in Chrome.
On your desktop Chrome browser, navigate tochrome://inspect. Confirm thatDiscover USB devicesis checked:
On your device, an alert prompts you to allow USB debugging from your computer. TapOK.
The messageUSB debugging connecteddisplays in the device's notification drawer.
Note: During remote debugging, Chrome prevents your device’s screen from going to sleep. This feature is useful for debugging, but is also less secure. So be sure to keep an eye on your device!
On your computer, thechrome://inspectpage displays every connected device, along with its open tabs and debug-enabled WebViews.
If you have problems finding your device on thechrome://inspect page, see theTroubleshootingsection.
Debugging remote browser tabs
From thechrome://inspect page, you can launch DevTools and debug your remote browser tabs.
To start debugging, clickinspectbelow the browser tab you want to debug.
A new instance of Chrome DevTools launches on your computer. From this instance, you can interact with the selected browser tab on your device in real time.
For example, you can use DevTools to inspect web page elements on your device:
When you mouse over an element in theElementspanel, DevTools highlights the element on your device.
You can also click theInspect Elementicon in DevTools and tap your device screen. DevTools highlights the tapped element in theElementspanel.
Note: The version of Chrome on your device determines the version of DevTools used during remote debugging. For this reason, the remote debugging DevTools might differ from the version that you normally use.
Debugging tips
Here are a few tips to help get you started with remote debugging:
UseF5(orCmd+ron Mac) to reload a remote page from the DevTools window.
Keep the device on a cellular network. Use theNetworkpanelto view the network waterfall under actual mobile conditions.
Use theTimelinepanelto analyze rendering and CPU usage. Hardware on mobile devices often runs much slower than on your development machine.
On Android 4.4 (KitKat) or later, you can use DevTools to debug WebView content in native Android applications.
Configure WebViews for debugging
WebView debugging must be enabled from within your application. To enable WebView debugging, call the static methodsetWebContentsDebuggingEnabledon the WebView class.
This setting applies to all of the application's WebViews.
Tip: WebView debugging isnotaffected by the state of thedebuggableflag in the application's manifest. If you want to enable WebView debugging only whendebuggableistrue, test the flag at runtime.
Thechrome://inspectpage displays a list of debug-enabled WebViews on your device.
To start debugging, clickinspectbelow the WebView you want to debug. Use DevTools as you would for aremote browser tab.
The gray graphics listed with the WebView represent its size and position relative to the device's screen. If your WebViews have titles set, the titles are listed as well.
Live screencasting
Shifting your attention between screens isn’t always convenient. Screencast displays your device's screen right alongside DevTools on your development machine. You can interact with the content on your device from the screencast too.
As of KitKat 4.4.3, screencast is available for both browser tabs and Android WebViews.
Start a screencast session
To start screencasting, click theScreencasticon in the upper right corner of your remote debugging DevTools window.
TheScreencastpanel opens on the left and displays a live view of your device's screen.
Screencast only displays page content. Transparent portions of the screencast are covered by the omnibox, device keyboard, and other device interfaces.
Note: Because screencast continuously captures frames, it has some performance overhead. If your tests are sensitive to frame rate, disable screencast.
Interact with your device using the screencast
When you interact with the screencast, clicks are translated into taps, firing proper touch events on the device. Keystrokes from your computer are sent to the device, so you can avoid typing with your thumbs.
Other DevTools work with the screencast too. For example, to inspect an element, click theInspect Elementicon and then click inside the screencast.
Tips: To simulate a pinch gesture, holdShiftwhile dragging. To scroll, use your trackpad or mouse wheel or fling with your pointer.
Port forwarding
Your phone can't always reach the content on your development server. They might be on different networks. Moreover, you might be developing on a restricted corporate network.
Port forwarding on Chrome for Android makes it easy to test your development site on mobile. It works by creating a listening TCP port on your mobile device that maps to a particular TCP port on your development machine. Traffic between these ports travels through USB, so the connection doesn't depend on your network configuration.
To enable port forwarding:
Openchrome://inspecton your development machine.
ClickPort Forwarding. The port forwarding settings display.
In theDevice portfield, enter the port number you want your Android device to listen on. (The default port is 8080.)
In theHostfield, enter the IP address (or hostname) and port number where your web application is running. This address can be any local location accessible from your development machine. Currently, port numbers must be between 1024 and 32767 (inclusive).
CheckEnable port forwarding.
ClickDone.
The port status indicators onchrome://inspectare green when port forwarding is successful.
Now you can open a new Chrome for Android tab and view the content of your local server on your device.
Virtual host mapping
Port forwarding works great when you're developing onlocalhost. But there are cases when you might be using a customized local domain.
For example, suppose you're using a third party JavaScript SDK that only works on whitelisted domains. So you added an entry, such as127.0.0.1 production.com, to yourhosts file. Or maybe you configured a customized domain using virtual hosts on your web server (MAMP).
If you want your phone to reach content on your customized domain, you can use port forwarding in combination with a proxy server. The proxy maps requests from your device to the correct location on the host machine.
Set up port forwarding to a proxy
Virtual host mapping requires you to run a proxy server on the host machine. All requests from your Android device will be forwarded to the proxy.
To set up port forwarding to a proxy:
On the host machine, install proxy software such asCharles Proxy(free trial available) orSquid.
Run the proxy server and note the port that it's using.
Note: The proxy server and your development server must be running on different ports.
In a Chrome browser, navigate tochrome://inspect.
ClickPort forwarding. The port forwarding settings display.
In theDevice portfield, enter the port number that you want your Android device to listen on. Use a port that Android allows, such as9000.
In theHostfield, enterlocalhost:xxxx, wherexxxxis the port your proxy is running on.
CheckEnable port forwarding.
ClickDone.
The proxy on the host machine is set up to make requests on behalf of your Android device.
Configure proxy settings on your device
Your Android device needs to communicate with the proxy on the host machine.
To configure the proxy settings on your device:
SelectSettings > Wi-Fi.
Long-press the network that you are currently connected to.
Note: Proxy settings apply per network.
TapModify network.
SelectAdvanced options. The proxy settings display.
Tap theProxymenu and selectManual.
In theProxy hostnamefield, enterlocalhost.
In theProxy portfield, enter9000.
TapSave.
With these settings, your device forwards all of its requests to the proxy on the host machine. The proxy makes requests on behalf of your device, so requests to your customized local domain are properly resolved.
Now you can load local domains on Chrome for Android just as you would on the host machine.
Tip: To resume normal browsing, remember to revert the proxy settings on your device after you disconnect from the host.
Troubleshooting
I can't see my device on thechrome://inspect page.
If you are developing onWindows, verify that the appropriate USB driver for your device is installed. SeeOEM USB Driverson the Android Developers' site.
Verify that the device is connected directly to your machine, bypassing any hubs.
Verify thatUSB debuggingis enabled on your device. Remember to accept the USB debugging permission alerts on your device.
On your desktop browser, navigate tochrome://inspectand verify thatDiscover USB devicesis checked.
Remote debugging requires your version of desktop Chrome to be newer than the version of Chrome for Android on your device. Try usingChrome Canary(Mac/Windows) or the ChromeDev channelrelease (Linux) on desktop.
If you still can't see your device, unplug it. On your device, selectSettings > Developer options. TapRevoke USB debugging authorizations. Then, retry thedevice setupanddiscovery processes.
I can't see my browser tabs on thechrome://inspectpage.
On your device, open the Chrome browser and navigate to the web page you want to debug. Then, refresh thechrome://inspectpage.
I can't see my WebViews on thechrome://inspect page.
On your device, open the app with the WebView you want to debug. Then, refresh thechrome://inspectpage.
I can't access my web server from my Android device.
If network restrictions prevent your mobile device from accessing your development server, try enablingport forwardingor setting up avirtual host map.
Lastly, if remote debugging still isn't working, you can revert to thelegacy workflowusing theadbbinary from the Android SDK.
Additional information
Remote debugging and ADB
You no longer need to configureADBor the ADB plugin to debug remote browser tabs and WebViews. Remote debugging for Android is now part of the standard Chrome DevTools. It works on all operating systems: Windows, Mac, Linux, and Chrome OS.
If you do encounter problems with remote debugging, you can try thelegacy workflowusing theadbbinary from the Android SDK.
Note: The direct USB connection between Chrome and the device might interrupt youradbconnection. Before establishing youradbconnection, uncheckDiscover USB devicesonchrome://inspect. Then, disconnect and reconnect the device.
Remote debugging for DevTools extension developers
This section provides data about the relative number of devices that have a particular screen configuration, defined by a combination of screen size and density. To simplify the way that you design your user interfaces for different screen configurations, Android divides the range of actual screen sizes and densities into several buckets as expressed by the table below.
For information about how you can support multiple screen configurations in your application, read Supporting Multiple Screens.
Open GL Version
This section provides data about the relative number of devices that support a particular version of OpenGL ES. Note that support for one particular version of OpenGL ES also implies support for any lower version (for example, support for version 2.0 also implies support for 1.1).