android-cli
它能做什么
这个技能指导安装和使用 android 命令行工具。它能帮助创建 Android 项目、在设备上安装应用、管理模拟器以及管理 SDK 组件。适合在终端中工作的 Android 开发者。
适用场景
- ✓当你想在命令行中创建一个新的 Android 项目时。
- ✓当你需要在设备或模拟器上安装 APK 并启动它的时候。
- ✓当你想从终端安装或更新 Android SDK 软件包的时候。
技能链接
https://github.com/android/skills/blob/main/devtools/android-cli/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请安装 android 命令行工具,并为这个项目设置我需要的 SDK 软件包。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能首先检查 android 工具是否在你的路径中,如果不在,则进行安装。然后它会给出 SDK 管理、项目创建和设备任务的命令。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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.
Installation
If the android tool is not in the path, install it. To install run the following command:
- Linux x86-64: curl -fsSL https://dl.google.com/android/cli/latest/linux_x86_64/install.sh | bash
- Linux ARM64: curl -fsSL https://dl.google.com/android/cli/latest/linux_arm64/install.sh | bash
- Mac Arm: curl -fsSL https://dl.google.com/android/cli/latest/darwin_arm64/install.sh | bash
- Mac Intel: curl -fsSL https://dl.google.com/android/cli/latest/darwin_x86_64/install.sh | bash
- Windows: curl -fsSL https://dl.google.com/android/cli/latest/windows_x86_64/install.cmd -o "%TEMP%\i.cmd" && "%TEMP%\i.cmd"
SDK management
To manage the installation of Android SDKs and tools, use the sdk command.
For example:
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-34android sdk update [<pkg-name>]: Update a specific package or all packages to the latest version.android sdk remove <pkg-name>: Remove a package from the local SDK.android sdk list --all: List installed and available SDK packages.
Project creation
Create projects from templates using the create command.
For example: android create empty-activity --name="My App" --output=./my-app
Interacting with Android devices
Use the android layout command to inspect the UI layout of an Android
application in JSON format. Use the android screen command to visually inspect
the UI and obtain bounding coordinates for visual regions.
android layout dumps the UI as JSON. android screen capture -o <file path> saves a PNG.
Both auto-select the device when only one is connected; with more than one, pass --device=<serial> (use adb devices to list serials).
UI Dump
android layout returns a JSON tree of the UI elements on screen.
Each JSON object represents a UI element in the Android app. The following properties may be present:
text- any literal text the element containsresource-id- the Android resource id used to refer to the elementcontent-desc- a description of a UI element for use by accessibility toolsinteractions- the set of user interactions the element supports. May contain one or more of:CHECKABLE,CLICKABLE,FOCUSABLE,SCROLLABLE,LONG-CLICKABLE,PASSWORDstate- the set of states the element is in. May contain one or more ofCHECKED,FOCUSED,SELECTEDbounds- the screen coordinates of the bounding rectangle of the element, in the format[min X,min Y][max X, max Y]center- the screen coordinates of the center of the element, in the format[x,y]off-screen- if true, the element is in the UI hierarchy but not within the bounds of the screen; it may require scrolling to view.hidden- if true, the element is in the UI hierarchy but not visible or interactive on screen.
Use layout as a primary means of examining an Android app.
By default, layout only returns elements that have content or are interactive:
- elements with non-empty
textorcontent-descproperties - elements with non-empty
interactionsorstateTo return all elements, use the--fullflag
If layout continues to fail, use android screen capture --annotate to inspect the app.
Screenshot
android screen capture -o <file path> (or --output=<file path>) saves a PNG of the current device screen to <file path>.
Use screen capture as a secondary means of examining an Android app
Examples:
- Understanding the content of an on-screen image
- Looking at a
WebView(web content does not always appear in the ui dump) - Trying to find a UI element by its visual appearance
IMPORTANT : Always VISUALLY examine the PNG image returned from any android screen command BEFORE doing anything else.
Annotated Screenshot
android screen capture --annotate -o <file path> (or -a -o <file path>)
android screen resolve --screenshot <path> --string <string>
The --annotate command adds numerical labels and bounding boxes around UI elements. Use this command to locate UI elements that cannot
be located in the layout output.
To refer to these labels in i
常见问题
哪些系统可以安装它?
该技能列出了适用于 Linux、Mac 和 Windows 的安装方式,并在适用的情况下提供 Intel 和 ARM 处理器的版本。
它可以管理模拟器吗?
可以。该工具可以管理 Android 虚拟设备,包括截图和检查屏幕。
如何更新 SDK 软件包?
使用 android sdk update 命令,它可以将某个软件包或全部软件包更新到最新版本。
详情
作者的原始描述
Provides instructions for installing and using the `android` CLI. The `android` command-line tool is a critical tool for Android development and helps you create new Android projects, install APKs onto devices and emulators and launch and run apps on them, manage and interact with Android virtual devices (including screenshots and UI inspection), manage Android SDK components, look up official Android documentation, and discover and install official Android skills.
repo: android/skills
热度
- GitHub 星标
- 10k
- 排名
- #11915
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/29
评论
- …
同一仓库的更多技能
agp-9-upgrade
10k帮你的智能体把 Android 应用升级到 Android Gradle Plugin 9,并处理其中的破坏性变更。不适用于多平台项目。
camerax
10k帮你的智能体使用 CameraX 构建 Android 相机功能,包括视频录制、硬件控制以及 ML Kit 和 Media3 效果。
android-for-cars-parked-apps
10k帮你的智能体把 Android 视频、游戏或浏览器应用调整为可在 Android Auto 和 Android Automotive 上以停放应用形式运行。
appfunctions
10k帮你的智能体在 Android 应用中找到关键工作流,并把它们暴露为 AI 智能体和语音命令可以运行的 AppFunctions。