blob: 2db3aeaef1fc2387b67759205e692ab3210785fb [file] [log] [blame] [view]
nodir02eda382015-08-25 14:55:521# Working remotely with Android
andybons3322f762015-08-24 21:37:092
nodir02eda382015-08-25 14:55:523[TOC]
andybons3322f762015-08-24 21:37:094
5
nodir02eda382015-08-25 14:55:526## Introduction
7
qyearsleyc0dc6f42016-12-02 22:13:398If you want to work remotely from your laptop with an Android device attached to
nodir02eda382015-08-25 14:55:529it, while keeping an ssh connection to a remote desktop machine where you have
10your build environment setup, you will have to use one of the two alternatives
11listed below.
12
13## Option 1: SSHFS - Mounting the out/Debug directory
andybons3322f762015-08-24 21:37:0914
andybons3322f762015-08-24 21:37:0915### On your laptop
nodir02eda382015-08-25 14:55:5216
qyearsleyc0dc6f42016-12-02 22:13:3917You have to have an Android device attached to it.
nodir02eda382015-08-25 14:55:5218
19```shell
andybons3322f762015-08-24 21:37:0920# Install sshfs
nodir02eda382015-08-25 14:55:5221
andybons3322f762015-08-24 21:37:0922laptop$ sudo apt-get install sshfs
23
24# Mount the chrome source from your remote host machine into your local laptop.
nodir02eda382015-08-25 14:55:5225
andybons3322f762015-08-24 21:37:0926laptop$ mkdir ~/chrome_sshfs
27laptop$ sshfs your.host.machine:/usr/local/code/chrome/src ./chrome_sshfs
28
qyearsleyc0dc6f42016-12-02 22:13:3929# Setup environment.
nodir02eda382015-08-25 14:55:5230
andybons3322f762015-08-24 21:37:0931laptop$ cd chrome_sshfs
Yun Liuf57cceaf2019-03-18 21:31:2332laptop$ third_party/android_sdk/public/platform-tools/adb devices
andybons3322f762015-08-24 21:37:0933
andybons3322f762015-08-24 21:37:0934# Run tests.
nodir02eda382015-08-25 14:55:5235
Andrew Grievefe71bbc2017-09-22 18:44:4036laptop$ out/Default/bin/run_$YOUR_TEST
andybons3322f762015-08-24 21:37:0937```
38
nodir02eda382015-08-25 14:55:5239*** note
40This is assuming you have the exact same linux version on your host machine and
41in your laptop.
42***
andybons3322f762015-08-24 21:37:0943
qyearsleyc0dc6f42016-12-02 22:13:3944But if you have different versions, lets say, Ubuntu Lucid on your laptop, and the newer Ubuntu Precise on your host machine, some binaries compiled on the host will not work on your laptop.
andybons3322f762015-08-24 21:37:0945In this case you will have to recompile these binaries in your laptop:
nodir02eda382015-08-25 14:55:5246
47```shell
andybons3322f762015-08-24 21:37:0948# May need to install dependencies on your laptop.
nodir02eda382015-08-25 14:55:5249
andybons3322f762015-08-24 21:37:0950laptop$ sudo ./build/install-build-deps-android.sh
51
52# Rebuild the needed binaries on your laptop.
nodir02eda382015-08-25 14:55:5253
andybons3322f762015-08-24 21:37:0954laptop$ ninja -C out/Debug md5sum host_forwarder
55```
56
nodir02eda382015-08-25 14:55:5257## Option 2: SSH Tunneling
andybons3322f762015-08-24 21:37:0958
nodir02eda382015-08-25 14:55:5259Copy /tools/android/adb_remote_setup.sh to your laptop, then run it.
60adb_remote_setup.sh updates itself, so you only need to copy it once.
andybons3322f762015-08-24 21:37:0961
nodir02eda382015-08-25 14:55:5262```shell
John Palmer046f9872021-05-24 01:24:5663laptop$ curl -sSf "https://chromium.googlesource.com/chromium/src.git/+/main/tools/android/adb_remote_setup.sh?format=TEXT" | base64 --decode > adb_remote_setup.sh
andybons3322f762015-08-24 21:37:0964laptop$ chmod +x adb_remote_setup.sh
65laptop$ ./adb_remote_setup.sh <desktop_hostname> <path_to_adb_on_desktop>
66```
67
Andrew Grievefe71bbc2017-09-22 18:44:4068### On your host machine
nodir02eda382015-08-25 14:55:5269
70```shell
Andrew Grievefe71bbc2017-09-22 18:44:4071desktop$ out/Default/bin/run_$YOUR_TEST
nodir02eda382015-08-25 14:55:5272```