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