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