|
| 1 | +--- |
| 2 | +name: android-cli |
| 3 | +description: Orchestrates Android development tasks including project creation, deployment, SDK management, and environment diagnostics using the `android` command-line tool. |
| 4 | +--- |
| 5 | +# Android CLI Specialist |
| 6 | + |
| 7 | +This skill provides instructions for using the `android` CLI tool. The tool includes various commands for creating projects, running applications, interacting with devices, and managing the CLI environment. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +If the android tool is not in the path, install it. To install run the following command: |
| 12 | +Linux: curl -fsSL https://dl.google.com/android/cli/latest/linux_x86_64/install.sh | bash |
| 13 | +Mac Arm: curl -fsSL https://dl.google.com/android/cli/latest/darwin_arm64/install.sh | bash |
| 14 | +Mac Intel: curl -fsSL https://dl.google.com/android/cli/latest/darwin_x86_64/install.sh | bash |
| 15 | +Windows: curl -fsSL https://dl.google.com/android/cli/latest/windows_x86_64/install.cmd -o "%TEMP%\i.cmd" && "%TEMP%\i.cmd" |
| 16 | + |
| 17 | +## SDK management |
| 18 | +To manage the installation of Android SDKs and tools, use the `sdk` command. For example: |
| 19 | + |
| 20 | +- `android sdk install <package>[@<version>]...`: Install specific packages. Multiple packages can be specified, separated by spaces. `<version>` defaults to latest. For example: `android sdk install platforms/android-30@2 platforms/android-34` |
| 21 | +- `android sdk update [<pkg-name>]`: Update a specific package or all packages to the latest version. |
| 22 | +- `android sdk remove <pkg-name>`: Remove a package from the local SDK. |
| 23 | +- `android sdk list --all`: List installed and available SDK packages. |
| 24 | + |
| 25 | +## Project creation |
| 26 | +Create projects from templates using the `create` command. |
| 27 | + |
| 28 | +For example: `android create empty-activity --name="My App" --output=./my-app` |
| 29 | + |
| 30 | +## Interacting with devices |
| 31 | +For more information on interacting with running devices, see [here](references/interact.md) |
| 32 | + |
| 33 | +## Running journey tests |
| 34 | +For more information on running journeys, see [here](references/journeys.md) |
| 35 | + |
| 36 | +## Doc searching |
| 37 | +The `docs` command searches authoritative, high-quality Android developer documentation in the Android Knowledge Base. |
| 38 | +By providing a few keywords, this tool will return high quality articles that contain examples or guidance on how to use Android APIs or libraries. |
| 39 | +Use this tool to obtain additional information on how to achieve Android-specific tasks or to know more about Android APIs, surfaces, libraries, or devices. |
| 40 | + |
| 41 | +Always use this tool to get the most up-to-date information about Android concepts. Typical good use cases are: |
| 42 | + - Finding migration guides for APIs. |
| 43 | + - Finding examples for APIs. |
| 44 | + - Finding up-to-date information about Android APIs. |
| 45 | + - Finding best practices for Android concepts. |
| 46 | + |
| 47 | +## Running APKs |
| 48 | +Use the `run` command to run Android apps. |
| 49 | + |
| 50 | +## Managing emulators |
| 51 | + |
| 52 | +Manage Android Virtual Devices (AVDs) using the `android emulator` command |
| 53 | + |
| 54 | +## Capturing screenshots |
| 55 | + |
| 56 | +Capture an image of the current screen of a connected Android device and output it to a file using the `android screenshot` command. |
| 57 | + |
| 58 | +## Managing skills |
| 59 | + |
| 60 | +Manage antigravity agent skills for Android using the `android skills` command. |
| 61 | + |
| 62 | +## Inspecting UI Layouts |
| 63 | + |
| 64 | +Use the `android layout` command to inspect the UI layout of an Android application. It returns the layout tree of an Android application in JSON format. When debugging UI errors, this is often a much faster approach than taking a screenshot. |
| 65 | + |
| 66 | +## Updating the CLI |
| 67 | + |
| 68 | +Update the Android CLI using the `android update` command. |
| 69 | + |
| 70 | +# `android help` output |
| 71 | + |
| 72 | +Usage: android [-hV] [--sdk=PARAM] [COMMAND] |
| 73 | + -h, --help Show this help message and exit. |
| 74 | + --sdk=PARAM Path to the Android SDK |
| 75 | + -V, --version Print version information and exit. |
| 76 | +Commands: |
| 77 | + create Create a new Android project |
| 78 | + describe Analyzes an Android project to generate descriptive metadata. |
| 79 | + docs Android documentation commands |
| 80 | + emulator Emulator commands |
| 81 | + help Shows the help of all commands |
| 82 | + info Print environment information (SDK Location, etc.) |
| 83 | + init Initializes the environment (eg. skills) for Android CLI. |
| 84 | + layout Returns the layout tree of an application |
| 85 | + run Deploy an Android Application |
| 86 | + screen Commands to view the device |
| 87 | + sdk Download and list SDK packages |
| 88 | + skills Manage skills |
| 89 | + studio Android Studio commands |
| 90 | + update Update the Android CLI |
| 91 | + |
| 92 | +create |
| 93 | + Usage: android create [-h] [--verbose] [--list] [--minSdk=api] |
| 94 | + --name=applicationName [-o=dest-path] [template-name] |
| 95 | + Create a new Android project |
| 96 | + [template-name] The template name |
| 97 | + -h, --help Show this help message and exit. |
| 98 | + --minSdk=api The 'minSdk' supported by the application (default |
| 99 | + is defined in the template) |
| 100 | + --name=applicationName |
| 101 | + The name of the application (e.g. 'My Application') |
| 102 | + -o, --output=dest-path The destination project directory path (default is |
| 103 | + '.') |
| 104 | + --verbose Enables verbose output |
| 105 | + --list List all available templates |
| 106 | + |
| 107 | +describe |
| 108 | + Usage: android describe [-hV] [--project_dir=PARAM] |
| 109 | + Analyzes an Android project to generate descriptive metadata. |
| 110 | + This command identifies and outputs the paths to JSON files that detail the |
| 111 | + project's structure, including build targets and their corresponding output |
| 112 | + artifact locations (e.g., APKs). This information enables other tools and |
| 113 | + commands to locate build artifacts efficiently. |
| 114 | + -h, --help Show this help message and exit. |
| 115 | + --project_dir=PARAM The project directory to describe |
| 116 | + -V, --version Print version information and exit. |
| 117 | + |
| 118 | +docs |
| 119 | + Usage: android docs [-h] [COMMAND] |
| 120 | + Android documentation commands |
| 121 | + -h, --help Show this help message and exit. |
| 122 | + Commands: |
| 123 | + search Search Android documentation |
| 124 | + fetch Fetch Android documentation |
| 125 | + |
| 126 | +emulator |
| 127 | + Usage: android emulator [-h] [COMMAND] |
| 128 | + Emulator commands |
| 129 | + -h, --help Show this help message and exit. |
| 130 | + Commands: |
| 131 | + create Creates a virtual device |
| 132 | + start Launches the specified virtual device. This command will return when |
| 133 | + the emulator is fully started and ready to use. |
| 134 | + stop Stops the specified virtual device |
| 135 | + list Lists available virtual devices |
| 136 | + remove Delete a virtual device |
| 137 | + |
| 138 | +help |
| 139 | + Usage: android help [COMMAND] |
| 140 | + Shows the help of all commands |
| 141 | + [COMMAND] The command to show help for |
| 142 | + |
| 143 | +info |
| 144 | + Usage: android info <field> |
| 145 | + Print environment information (SDK Location, etc.) |
| 146 | + <field> The specific field to print the value of. If omitted print all. |
| 147 | + |
| 148 | +init |
| 149 | + Usage: android init |
| 150 | + Initializes the environment (eg. skills) for Android CLI. |
| 151 | + |
| 152 | +layout |
| 153 | + Usage: android layout [-dhp] [--device=PARAM] [-o=PARAM] |
| 154 | + Returns the layout tree of an application |
| 155 | + -d, --diff Returns a flat list of the layout elements that have |
| 156 | + changed since the last invocation of ui-dump |
| 157 | + --device=PARAM The device serial number |
| 158 | + -h, --help Show this help message and exit. |
| 159 | + -o, --output=PARAM Writes the layout tree to the specified file or |
| 160 | + directory. If omitted, prints the tree to standard |
| 161 | + output |
| 162 | + -p, --pretty Pretty-prints the returned JSON |
| 163 | + |
| 164 | +run |
| 165 | + Usage: android run [-h] [--debug] [--activity=PARAM] [--device=PARAM] |
| 166 | + [--type=PARAM] [--apks=PARAM[,PARAM...]]... |
| 167 | + Deploy an Android Application |
| 168 | + --activity=PARAM The activity name |
| 169 | + --apks=PARAM[,PARAM...] |
| 170 | + The paths to the APKs |
| 171 | + --debug Run in debug mode |
| 172 | + --device=PARAM The device serial number |
| 173 | + -h, --help Show this help message and exit. |
| 174 | + --type=PARAM The component type (ACTIVITY, SERVICE, etc.) |
| 175 | + |
| 176 | +screen |
| 177 | + Usage: android screen [-h] [COMMAND] |
| 178 | + Commands to view the device |
| 179 | + -h, --help Show this help message and exit. |
| 180 | + Commands: |
| 181 | + capture Outputs the device screen to a PNG |
| 182 | + resolve Target UI elements visually |
| 183 | + |
| 184 | +sdk |
| 185 | + Usage: android sdk [COMMAND] |
| 186 | + Download and list SDK packages |
| 187 | + Commands: |
| 188 | + install Install SDK packages |
| 189 | + update Update one or all packages to the latest version |
| 190 | + remove Remove a package from the SDK |
| 191 | + list List installed and available SDK packages |
| 192 | + |
| 193 | +skills |
| 194 | + Usage: android skills [COMMAND] |
| 195 | + Manage skills |
| 196 | + Commands: |
| 197 | + add Install a skill |
| 198 | + remove Remove a skill |
| 199 | + list List available skills |
| 200 | + find Find skills by keyword |
| 201 | + |
| 202 | +studio |
| 203 | + Usage: android studio [-h] [COMMAND] |
| 204 | + Android Studio commands |
| 205 | + -h, --help Show this help message and exit. |
| 206 | + Commands: |
| 207 | + find-declaration Find declaration of a symbol |
| 208 | + find-usages Find usages of a symbol |
| 209 | + open-file Open a file in Android Studio |
| 210 | + check Check the status of running Studio instances |
| 211 | + analyze-file Analyze a file in Android Studio |
| 212 | + render-compose-preview Render a Compose preview in Android Studio |
| 213 | + version-lookup Looks up the latest available versions on the |
| 214 | + internet of maven artifacts, Android versions, and |
| 215 | + more. |
| 216 | + |
| 217 | +update |
| 218 | + Usage: android update [--url=PARAM] |
| 219 | + Update the Android CLI |
| 220 | + --url=PARAM The URL to download the update from |
| 221 | + |
0 commit comments