/ Google Chrome

Chrome Remote Debugging on Windows

I've had trouble with this before, apparently, so this time I'm documenting the process. The official Google docs leave out a couple of setup steps, which is seriously frustrating.

Drivers

You'll need to find your OEM USB drivers and install them. Device Manager should report the correct device when connected:

PS> mmc devmgmt.msc

successful-device-manager
I'm using a couple of Samsung phones, as you can see from the list.

Install the Android Debug Bridge

You need the Android Debug Bridge in addition to OEM drivers.

Fast Installation

If you use a package manager like Chocolatey, this is pretty easy. Swap choco for whatever you use:

PS> choco install -y adb
Chocolatey v0.10.7
Installing the following packages:
adb
By installing you accept licenses for the packages.
Progress: Downloading adb 1.0.39.20171026... 100%

adb v1.0.39.20171026 [Approved]
adb package files install completed. Performing other installation steps.
Downloading adb
from 'https://dl-ssl.google.com/android/repository/platform-tools_r26.0.2-windows.zip'
Progress: 100% - Completed download of C:\path\to\user\AppData\Local\Temp\chocolatey\adb\1.0.39.20171026\platform-tools_r26.0.2-windows.zip (9.31 MB).
Download of platform-tools_r26.0.2-windows.zip (9.31 MB) completed.
Hashes match.
Extracting C:\path\to\user\AppData\Local\Temp\chocolatey\adb\1.0.39.20171026\platform-tools_r26.0.2-windows.zip to C:\ProgramData\chocolatey\lib\adb\tools...
C:\path\to\chocolatey\lib\adb\tools
ShimGen has successfully created a shim for adb.exe
ShimGen has successfully created a shim for fastboot.exe
The install of adb was successful.
Software installed to 'C:\path\to\chocolatey\lib\adb\tools'

Chocolatey installed 1/1 packages.
See the log for details (C:\path\to\chocolatey\logs\chocolatey.log).
PS> refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..

Manual Installation

Check the release page to make sure the link is still current. This will install it in your home directory; it's up to you to either remember the path or add it to the environment path.

PS> cd ~
PS> Invoke-WebRequest -Uri "https://dl.google.com/android/repository/platform-tools-latest-windows.zip" -OutFile "platform-tools-latest-windows.zip"
PS> Expand-Archive ".\platform-tools-latest-windows.zip"
PS> Move-Item ".\platform-tools-latest-windows\platform-tools" ".\"
PS> Rename-Item ".\platform-tools" ".\android-platform-tools"
PS> cd ".\android-platform-tools"
PS> dir

Directory: C:\path\to\home\android-platform-tools

Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 12/24/2017 11:43 PM api
d----- 12/24/2017 11:43 PM lib64
d----- 12/24/2017 11:43 PM systrace
-a---- 12/13/2017 9:24 PM 1784320 adb.exe
-a---- 12/13/2017 9:24 PM 97792 AdbWinApi.dll
-a---- 12/13/2017 9:24 PM 62976 AdbWinUsbApi.dll
-a---- 12/13/2017 9:24 PM 145920 dmtracedump.exe
-a---- 12/13/2017 9:24 PM 333824 etc1tool.exe
-a---- 12/13/2017 9:24 PM 853504 fastboot.exe
-a---- 12/13/2017 9:24 PM 43008 hprof-conv.exe
-a---- 12/13/2017 9:24 PM 210625 libwinpthread-1.dll
-a---- 12/13/2017 9:24 PM 345600 make_f2fs.exe
-a---- 12/13/2017 9:24 PM 1184 mke2fs.conf
-a---- 12/13/2017 9:24 PM 1034240 mke2fs.exe
-a---- 12/13/2017 9:24 PM 323847 NOTICE.txt
-a---- 12/13/2017 9:24 PM 38 source.properties
-a---- 12/13/2017 9:24 PM 793600 sqlite3.exe

Enable USB Debugging

Follow the official instructions (most likely tap Settings > About Phone > Build Number several times) to enable Developer Options. After doing so, a new line, Developer options, will appear in Settings.

settings-with-dev

Somewhere in Developer options should be a toggle switch to enable USB debugging.

dev-usb-debugging

Launch adb

With USB debugging turned on and the phone connected to your computer, launch adb.

PS> adb devices
List of devices attached
* daemon not running. starting it now at tcp:5037 *
* daemon started successfully *
somehash unauthorized

On your phone, allow the connection (if the fingerprint checks out).

allow-connection

Verify the device connected properly via adb.

PS> adb devices
List of devices attached
somehash device

Access in DevTools

Visit chrome://inspect/#devices to make sure the device is connected. You must be signed in. The official docs explain this part well.

Sources

I used this XDA post as a basis for adb installation. I later discovered this StackOverflow answer while researching some issues. I wrote all the PowerShell and created all the images.

Environment

CJ Harries

I did a thing once. Change "blog." to "cj@" and you've got my email. All these opinions are mine and might not be shared by clients or employers.

Read More