Remote Debugging Android Devices

Remote Debugging Android Devices

//在电脑上远程调试安卓设备

By Kayce Basques

Technical Writer at Google

By Meggin Kearney

Meggin is a Tech Writer

Remote debug live content on an Android device from your Windows, Mac, or Linux computer.//远程实时调试安卓设备的内容。

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 machine.
  • Screencast content from your Android device into DevTools.

Requirements

To begin remote debugging, you need:

  • Chrome 32 or later installed on your development machine.//电脑上安卓版本号32或者更高的Chrome浏览器。
  • USB drivers installed on your development machine, if you‘re using Windows. (Ensure Device Manager reports the USB driver correctly)//电脑上安装了安卓设备对应的usb 驱动。
  • A USB cable to connect your Android device to your development machine.//用usb线缆连接安卓设备和电脑。
  • Android 4.0 or later.//安卓版本4.0或者更高。
  • Chrome for Android installed on your Android device.//安卓设备上安装Chrome浏览器。

Enable USB debugging on your Android device

On your Android device, open up Settings, find the Developer options section, and enable USB debugging. If you‘re running Android 4.2 or later and you can‘t find Developer options you may need to enable it.//开启安卓设备的开发者选项。

Connect and discover your Android device

On your development machine, open Chrome. You should be logged in to one of your user profiles. Remote debugging does not work in incognito or guest mode.//按下F12键进入开发者工具界面,然后点击三个点图案的菜单-->More tools-->Inspect devices。

Open DevTools and select More tools > Inspect devices.

From here you can see the status of all connected remote devices. You don‘t have any devices connected right now, so your dialog should look similar to the following screenshot. Make sure thatDiscover USB devices is enabled.//确保勾选了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 that is 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 permissions.

Tip: If you have 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 here you can see a variety of information about your connected Andoid device:

  • At the top you can see the model name of your Android device followed by its serial number (for example, Nexus 5 #08ae8c2700f43a61).
  • If one or more Chrome tabs are open, then you‘ll see a Chrome heading followed by the version number of Chrome that‘s running (for example, Chrome (49.0.2623.105)). If no Chrome tabs are open, you won‘t see a Chrome heading.
  • Underneath the Chrome heading, each open tab gets its own heading. You can interact with that tab from this section.
  • If there are any running apps using WebView, you‘ll see a heading for each app.

To open a new Chrome tab, enter a URL in the textfield under the Chrome heading and then clickOpen. A new tab automatically opens and loads the specified URL.

To reload, focus, or close an 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 that you want to investigate. A new instance of DevTools opens up on 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 on your development machine may look different than what you‘re used to.

When you hover over or select an element in the Elements panel, that element is highlighted on your Android device.

You can also tap on your Android device screen 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 that you 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 your 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 is sensitive to frame rates.

You can interact with the screencast in multiple ways:

  • Clicks are translated into taps, firing proper touch events on the device.
  • Keystrokes on your computer are sent to the device.
  • To simulate a pinch gesture, hold Shift while 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 code samples are licensed under the Apache 2.0 License. For details, see our Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

上次更新日期:十一月 16, 2016

时间: 2024-10-21 02:12:25

Remote Debugging Android Devices的相关文章

通过Chrome浏览器进行android调试/Remote Debugging on Android with Chrome

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. Remote debugging on Android

移动端Web开发调试之Chrome远程调试(Remote Debugging)

本篇主要说一下Chrome RemoteDebugging 的方法,之前也遇到一些坑,自己总结了一些经验,分享如下. Chrome DevTools调试移动设备Brower Page Tabs/WebViews 安卓远程调试目前支持所有操作系统(Windows,Mac, Linux, and Chrome OS.)中调试,支持: ● 调试站点的页面 ● 调试安卓原生App中的WebView ● 实时将安卓设备的屏幕图像同步显示到开发机器. ● 通过端口转发(port forwarding)与虚拟

安卓手机移动端Web开发调试之Chrome远程调试(Remote Debugging)

一.让安卓打debug模式的apk包 二.将电脑中的chrome升级到最新版本,在chrome浏览器地址栏中输入chrome://inspect/#devices: 在智能手机还未普及时,移动设备的调试处处是alert的,这估计是最常用的办法了.以前很多时候为了预览页面在移动设备上的效果,需要先将页面上传到测试服务器,再将url输入到设备浏览器,或者使用第三方二维码扫码应用,通过移动设备访问打开浏览实际效果,每次换设备都要重复这些操作,页面多的话这些繁琐的事情就特别让人厌烦了.移动互联网的浪潮,

在chrome 总调试cordova出现Detached from the target. Remote debugging has been terminated with reason: Connection lost. Please re-attach to the new target

在chrome 总调试cordova出现如下错误: "Detached from the target. Remote debugging has been terminated with reason: Connection lost. Please re-attach to the new target办法,如果是模拟器,请降级到android 5.0以下.

Jetty Remote Debugging

Via command line $ java -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=n -jar start.jar Via start.ini ## Enable remote debugging --exec -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=n

VS 本地调试 x64 平台 “Visual Studio Remote Debugging Monitor 已停止工作” 问题解决

之前有一阵子发现Visual Studio 2012 的x64平台不能直接debug,总是报如下错误,查找了一下,得知VS的x64是建立在x86的远程调试上,而不是独立运行. 猜测就是远程调试上出了问题,但修改各种设置,重装软件,都没有用. 只有将x64改成x86平台,用不到远程调试机制,也就天下太平了.但是我的程序里调用的就是x64的库,没办法,将就过了一段不能调试的日子,后来不知道怎么的又好了,就稀里糊涂的把这问题给糊弄过去了. 直到这次想上外网查东西,登录Astrill SVN时,总是报错

How to Install apk to Android Devices from Mac OS X

##adb命令是安装到platform-tools目录中,而非上一步android命令所在的tools目录. $ cd /opt/local/share/java/android-sdk-mac_x86/platform-tools ##先探测是否可以正确识别设备,有设备号和device字样表示正确识别. $ ./adb devices List of devices attached 01839c14 device ##安装apk软件,本例中安装的是高德移动导航 $ ./adb install

[quote] debugging android Bluetooth (Broadcom Bluetooth and low-power mode)

URL:  http://www.phonesdevelopers.com/1695137/ First the combination of grasping this part of the project from a whole: The Bluetooth module core file is bluetooth.c on electricity, I will call this file bt_enable () function, first call this functio

[Python] Remote debugging by Pycharm

From: http://blog.csdn.net/u013088062/article/details/50170551 虚拟环境配置 配置远程解释器 设想这样一种情况,你在一个平台上操作你的工程,但你希望在另外一个平台上完善并运行它,这就是为什么Pycharm做了很多工作来支持远程调试. 虚拟环境配置 在虚拟机上运行一个工程主要包含以下步骤: (1)定义一个虚拟框架define a virtual box (2)需要在虚拟框架下配置一个远程的解释器configure a remote in