android-cli
Skill này làm gì
Skill này hướng dẫn cài đặt và dùng công cụ dòng lệnh android. Nó hỗ trợ tạo dự án Android, cài ứng dụng lên thiết bị, quản lý trình giả lập và quản lý các thành phần SDK. Nó dành cho lập trình viên Android làm việc từ terminal.
Khi nào nên dùng
- ✓Khi bạn muốn tạo một dự án Android mới từ dòng lệnh.
- ✓Khi bạn cần cài một file APK lên thiết bị hoặc trình giả lập và mở nó.
- ✓Khi bạn muốn cài hoặc cập nhật các gói SDK của Android từ terminal.
Liên kết skill
https://github.com/android/skills/blob/main/devtools/android-cli/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Cài công cụ dòng lệnh android và thiết lập các gói SDK tôi cần cho dự án này.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill trước tiên kiểm tra xem công cụ android đã có trong đường dẫn của bạn chưa, và cài đặt nếu chưa có. Sau đó nó đưa ra các lệnh để quản lý SDK, tạo dự án và thực hiện tác vụ trên thiết bị.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Những hệ thống nào có thể cài đặt nó?
Skill liệt kê các trình cài đặt cho Linux, Mac và Windows, kèm phiên bản cho bộ xử lý Intel và ARM khi có áp dụng.
Nó có quản lý được trình giả lập không?
Có. Công cụ có thể quản lý các thiết bị ảo Android, gồm chụp ảnh màn hình và kiểm tra màn hình.
Làm sao cập nhật các gói SDK?
Dùng lệnh android sdk update, lệnh này cập nhật một gói hoặc tất cả các gói lên phiên bản mới nhất.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 10k
- Vị trí xếp hạng
- #11915
- Giấy phép
- Apache-2.0
- Cập nhật
- 29/10/2026
Bình luận
- …
Thêm skill từ kho mã này
agp-9-upgrade
10kGiúp agent của bạn nâng cấp ứng dụng Android lên Android Gradle Plugin 9 và xử lý các thay đổi gây lỗi. Không dành cho dự án đa nền tảng.
camerax
10kGiúp agent của bạn xây dựng các tính năng camera Android bằng CameraX, gồm quay video, điều khiển phần cứng, ML Kit và hiệu ứng Media3.
android-for-cars-parked-apps
10kĐiều chỉnh một ứng dụng video, trò chơi hoặc trình duyệt Android để chạy như ứng dụng khi xe đỗ trên Android Auto và Android Automotive.
appfunctions
10kTìm các luồng công việc chính trong ứng dụng Android và công khai chúng dưới dạng AppFunctions để agent AI và lệnh giọng nói có thể chạy.
Skill tương tự
android-clean-architecture
280kGiúp agent của bạn tổ chức dự án Android hiệu quả, cấu trúc code để việc bảo trì và phát triển tính năng mới dễ dàng hơn.
compose-multiplatform-patterns
280kGiúp agent của bạn dùng các mẫu Compose Multiplatform và Jetpack Compose trong dự án KMP, gồm trạng thái, điều hướng, giao diện và hiệu năng.
dart-flutter-patterns
280kGiúp agent của bạn viết code cho ứng dụng Dart và Flutter. Agent dùng các mẫu hiện đại để tạo ứng dụng vững chắc và dễ quản lý.