cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 1 | # **Acloud Manual** |
Kevin Cheng | ab0b36b | 2018-08-02 14:38:30 -0700 | [diff] [blame] | 2 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 3 | ## **Acloud** |
Tri Vo | 0809e5f | 2016-10-07 15:10:42 -0700 | [diff] [blame] | 4 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 5 | Acloud is a command line tool that assists users to create an Android Virtual |
| 6 | Device (AVD). |
Tri Vo | 0809e5f | 2016-10-07 15:10:42 -0700 | [diff] [blame] | 7 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 8 | ## **Table of Contents** |
Tri Vo | 0809e5f | 2016-10-07 15:10:42 -0700 | [diff] [blame] | 9 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 10 | 1. [Environment Setup](#Environment-Setup) |
| 11 | 2. [Basic Usage](#Basic-Usage) |
Tri Vo | 05f0189 | 2017-03-02 11:28:31 -0800 | [diff] [blame] | 12 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 13 | ### **Environment Setup** |
Tri Vo | 05f0189 | 2017-03-02 11:28:31 -0800 | [diff] [blame] | 14 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 15 | Add acloud to your $PATH by lunching your environment. |
Tri Vo | 05f0189 | 2017-03-02 11:28:31 -0800 | [diff] [blame] | 16 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 17 | * Source envsetup.sh from the root of the android source checkout |
| 18 | |
Kevin Cheng | 9d96e16 | 2019-01-10 23:56:39 -0800 | [diff] [blame] | 19 | ``` |
| 20 | $ source build/envsetup.sh |
| 21 | ``` |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 22 | |
| 23 | * Run lunch for an AVD target |
| 24 | |
Kevin Cheng | 9d96e16 | 2019-01-10 23:56:39 -0800 | [diff] [blame] | 25 | ``` |
| 26 | $ lunch aosp_cf_x86_phone-userdebug |
| 27 | ``` |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 28 | |
| 29 | |
| 30 | You should now be able to call acloud from anywhere. |
| 31 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 32 | ### **Basic Usage** |
| 33 | |
| 34 | Acloud commands take the following form: |
| 35 | |
| 36 | **acloud <command> <optional arguments>** |
| 37 | |
| 38 | Available commands: |
| 39 | |
| 40 | * [create](#create) |
| 41 | * [list](#list) |
| 42 | * [delete](#delete) |
| 43 | * [reconnect](#reconnect) |
| 44 | * [setup](#setup) |
herbertxue | 2904a68 | 2019-10-25 11:33:55 +0800 | [diff] [blame] | 45 | * [pull](#pull) |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 46 | |
| 47 | #### **create** |
| 48 | |
| 49 | Create is the main entry point in creating an AVD, supporting both remote |
| 50 | instance (running on a virtual machine in the cloud) and local instance |
| 51 | (running on your local host) use cases. You also have the option to use |
| 52 | a locally built image or an image from the Android Build servers. |
| 53 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 54 | Here's a quick cheat-sheet for the 4 use cases: |
| 55 | |
| 56 | * Remote instance using an Android Build image (LKGB (Last Known Good Build) |
Ed Heyl | 7a0ca64 | 2020-07-27 17:59:56 +0000 | [diff] [blame] | 57 | for cuttlefish phone target in the branch of your repo, default aosp main (master) |
Kevin Cheng | 44aeac4 | 2019-06-20 14:56:55 -0700 | [diff] [blame] | 58 | if we can't determine it) |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 59 | |
| 60 | > $ acloud create |
| 61 | |
Kevin Cheng | 44aeac4 | 2019-06-20 14:56:55 -0700 | [diff] [blame] | 62 | * Remote instance using a locally built image (use `m` to build the image) |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 63 | |
Kevin Cheng | 44aeac4 | 2019-06-20 14:56:55 -0700 | [diff] [blame] | 64 | > $ acloud create --local-image [optional local-image-path] |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 65 | |
| 66 | * Local instance using an Android Build image (LKGB for cuttlefish phone |
| 67 | target in the branch of your repo) |
| 68 | |
| 69 | > $ acloud create --local-instance |
| 70 | |
Kevin Cheng | 44aeac4 | 2019-06-20 14:56:55 -0700 | [diff] [blame] | 71 | * Local instance using a locally built image (use `m` to build the image) |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 72 | |
| 73 | > $ acloud create --local-instance --local-image |
| 74 | |
| 75 | When specifying an Android Build image, you can specify the branch, |
| 76 | target and/or build id (e.g. `--branch my_branch`). Acloud will assume the |
| 77 | following if they're not specified: |
| 78 | |
| 79 | * `--branch`: The branch of the repo you're running the acloud command in, e.g. |
Ed Heyl | 7a0ca64 | 2020-07-27 17:59:56 +0000 | [diff] [blame] | 80 | in an aosp repo on the master branch, acloud will infer the aosp-main (aosp-master) branch. |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 81 | |
| 82 | * `--build-target`: Defaults to the phone target for cuttlefish (e.g. |
Ed Heyl | 7a0ca64 | 2020-07-27 17:59:56 +0000 | [diff] [blame] | 83 | aosp\_cf\_x86\_phone-userdebug in aosp-main (aosp-master)). |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 84 | |
| 85 | * `--build-id`: Default to the Last Known Good Build (LKGB) id for the branch and |
| 86 | target set from above. |
| 87 | |
| 88 | Additional helpful create options are: |
| 89 | |
morrislin | 3dd56e9 | 2021-07-15 11:27:32 +0800 | [diff] [blame] | 90 | * `--config`: This can be one of phone, auto, tablet, tv. This wil be used to configure different types of hardware properties and infer build target if not specified. |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 91 | |
chojoyce | f8ebfc0 | 2021-10-20 12:53:33 +0800 | [diff] [blame] | 92 | * `--autoconnect`: Cuttlefish AVD defaults to webrtc and acloud will automatically open the browser upon creation of a remote or local instance. |
| 93 | Acloud will also create a ssh tunnel to enable adb and webrtc connection to the instance. Other AVD types(such as goldfish, cheeps...) still default to vnc. |
| 94 | |
| 95 | * If you want to invoke vnc client, you can pass in `--autoconnect vnc`. |
| 96 | * If you don't want autoconnect, you can pass in `--no-autoconnect`. |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 97 | |
| 98 | * `--hw-property`: This is a string where you can specify the different |
| 99 | properties of the AVD. You can specify the cpu, resolution, dpi, memory,and/or |
| 100 | disk in a key:value format like so: |
| 101 | `cpu:2,resolution:1280x700,dpi:160,memory:2g,disk:2g` |
| 102 | |
cylan | dad401b | 2019-11-07 10:11:34 +0800 | [diff] [blame] | 103 | * `--reuse-gce`: 'cuttlefish only' This can help users use their own instance. |
| 104 | Reusing specific gce instance if `--reuse-gce` [instance-name] is provided. |
| 105 | Select one gce instance to reuse if `--reuse-gce` is provided. |
| 106 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 107 | The full list of options are available via `--help` |
| 108 | |
| 109 | > $ acloud create --help |
| 110 | |
| 111 | #### **list** |
| 112 | |
| 113 | List will retrieve all the remote instances you've created in addition to |
| 114 | any local instances created as well. |
| 115 | |
| 116 | Cheatsheet: |
| 117 | |
| 118 | * List will show device IP address, adb port and instance name. |
| 119 | |
| 120 | > $ acloud list |
| 121 | |
| 122 | * List -v will show more detail info on the list. |
| 123 | |
| 124 | > $ acloud list -v |
| 125 | |
| 126 | |
| 127 | #### **delete** |
| 128 | |
| 129 | Delete will stop your remote and local instances. Acloud will find all |
| 130 | instances created by you and stop them. If more than one instance is found |
| 131 | (remote or local), you will be prompted to select which instance you would |
| 132 | like to stop. |
| 133 | |
| 134 | Cheatsheet: |
| 135 | |
| 136 | * Delete sole instance or prompt user with list of instances to delete. |
| 137 | |
| 138 | > $ acloud delete |
| 139 | |
| 140 | * Delete all instances |
| 141 | |
| 142 | > $ acloud delete --all |
| 143 | |
| 144 | * Delete a specific instance |
| 145 | |
| 146 | > $ acloud delete --instance-names [instance-name] |
| 147 | |
| 148 | #### **reconnect** |
| 149 | |
chojoyce | f8ebfc0 | 2021-10-20 12:53:33 +0800 | [diff] [blame] | 150 | Reconnect will re-establish ssh tunnels for adb/webrtc/vnc port forwarding for all |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 151 | remote instance created by you. It will then look for any devices missing in |
chojoyce | f8ebfc0 | 2021-10-20 12:53:33 +0800 | [diff] [blame] | 152 | `adb devices` and reconnect them to adb. Lastly it will restart webrtc/vnc for all |
| 153 | devices that don't already have webrtc/vnc started for them. |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 154 | |
| 155 | Cheatsheet: |
| 156 | |
| 157 | * Reconnect sole instance or prompt user with list of instances to reconnect. |
| 158 | |
| 159 | > $ acloud reconnect |
| 160 | |
| 161 | * Reconnect all instances |
| 162 | |
| 163 | > $ acloud reconnect --all |
| 164 | |
| 165 | * Reconnect a specific instance |
| 166 | |
| 167 | > $ acloud reconnect --instance-names [instance-name] |
| 168 | |
| 169 | |
herbertxue | 2904a68 | 2019-10-25 11:33:55 +0800 | [diff] [blame] | 170 | ### **pull** |
| 171 | |
| 172 | Pull will provide all log files to download or show in screen. It is helpful |
| 173 | to debug about AVD boot up fail or AVD has abnromal behaviors. |
| 174 | |
| 175 | Cheatsheet: |
| 176 | |
| 177 | * Pull logs from a sole instance or prompt user to choose one to pull if where |
| 178 | are more than one active instances. |
| 179 | |
| 180 | > $ acloud pull |
| 181 | |
| 182 | * Pull logs from the specific instance. |
| 183 | |
| 184 | > $ acloud pull --instance-name "instance-name" |
| 185 | |
| 186 | * Pull a specific log file from a specific instance |
| 187 | |
| 188 | > $ acloud pull --instance-name "instance-name" --file-name "file-name" |
| 189 | |
| 190 | |
cylan | 40cd17b | 2018-12-03 15:32:22 +0800 | [diff] [blame] | 191 | #### **setup** |
| 192 | |
| 193 | Setup will walk you through the steps needed to set up your local host to |
| 194 | create a remote or local instance. It will automatically get invoked through |
| 195 | the create command if we detect some necessary setup steps are required. This |
| 196 | is a standalone command if the user wants to do setup separate from the create |
| 197 | command. |
| 198 | |
| 199 | Cheatsheet: |
| 200 | |
| 201 | * Run setup for remote/local instances |
| 202 | |
| 203 | > $ acloud setup |
| 204 | |
| 205 | * Run setup for remote instances only |
| 206 | |
| 207 | > $ acloud setup --gcp-init |
| 208 | |
| 209 | * Run setup for local instances only |
| 210 | |
| 211 | > $ acloud setup --host |
| 212 | |
| 213 | * Force run setup |
| 214 | |
| 215 | > $ acloud setup --force |
| 216 | |
| 217 | * * * |
| 218 | |
| 219 | If you have any questions or feedback, contact [acloud@google.com](mailto:acloud@google.com). |
| 220 | |
morrislin | 3dd56e9 | 2021-07-15 11:27:32 +0800 | [diff] [blame] | 221 | If you have any bugs or feature requests email them to [buganizer-system+419709@google.com](mailto:buganizer-system+419709@google.com) |