Android CLI スペシャリスト
このスキルは、android CLI ツールの使用方法を提供します。このツールには、プロジェクトの作成、アプリケーションの実行、デバイスとの対話、CLI 環境の管理のためのさまざまなコマンドが含まれています。
インストール
android ツールがパスにない場合は、インストールしてください。インストールするには、次のコマンドを実行します:
Linux: curl -fsSL https://dl.google.com/android/cli/latest/linux_x86_64/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 管理
Android SDK とツールのインストールを管理するには、sdk コマンドを使用します。例:
android sdk install <package>[@<version>]...: 特定のパッケージをインストールします。複数のパッケージをスペース区切りで指定できます。<version>はデフォルトで最新版になります。例:android sdk install platforms/android-30@2 platforms/android-34android sdk update [<pkg-name>]: 特定のパッケージ、またはすべてのパッケージを最新バージョンに更新します。android sdk remove <pkg-name>: ローカル SDK からパッケージを削除します。android sdk list --all: インストール済みおよび利用可能な SDK パッケージを一覧表示します。
プロジェクト作成
create コマンドを使用して、テンプレートからプロジェクトを作成します。
例: android create empty-activity --name="My App" --output=./my-app
Android デバイスとの対話
android layout コマンドを使用して、Android アプリケーションの UI レイアウトを JSON 形式で検査します。
android screen コマンドを使用して、UI を視覚的に検査し、視覚領域のバウンディング座標を取得します。
重要: android layout または android screen を使用する前に、必ず次のリファレンスをお読みください: interact.md
リファレンスファイル interact.md には、Android デバイスと正しく対話するための手順が含まれています。その指示に正確に従ってください。
ジャーニーテストの実行
ジャーニーテストにはデバイス操作が含まれます。ジャーニーを評価するには、android layout および android screen コマンドを使用します。
デバイス操作の手順もここに適用されます。
重要: ジャーニーを評価する前に、必ず次のリファレンスをお読みください: journeys.md リファレンスファイル journeys.md には、Android ジャーニーを正しく評価するための手順が含まれています。その指示に正確に従ってください。
ドキュメント検索
docs コマンドは、Android ナレッジベースから信頼性の高い高品質な Android 開発者ドキュメントを検索します。
いくつかのキーワードを指定すると、Android API やライブラリの使用方法に関する例やガイダンスを含む高品質な記事が返されます。
このツールを使用して、Android 固有のタスクを達成するための追加情報を取得したり、Android API、サーフェス、ライブラリ、デバイスについてさらに詳しく知ることができます。
Android の概念に関する最新情報を入手するには、常にこのツールを使用してください。典型的な使用例は次のとおりです:
- API の移行ガイドを見つける。
- API の例を見つける。
- Android API に関する最新情報を見つける。
- Android の概念に関するベストプラクティスを見つける。
APK の実行
run コマンドを使用して Android アプリを実行します。
エミュレータの管理
android emulator コマンドを使用して、Android 仮想デバイス (AVD) を管理します。
スクリーンショットのキャプチャ
android screen コマンドを使用して、接続された Android デバイスの現在の画面の画像をキャプチャし、ファイルに出力します。
スキルの管理
android skills コマンドを使用して、Android 用のエージェントスキルを管理します。
CLI の更新
android update コマンドを使用して、Android CLI を更新します。
android help 出力
Usage: android [-Vhv] [--sdk=PARAM] [COMMAND] -h, --help Show the help message for this command --sdk=PARAM Path to the Android SDK -v, --verbose Enable verbose output for troubleshooting -V, --version Print version information and exit Commands: completion Installs shell autocomplete configuration for the Android CLI in the current user profile create Create a new Android project from available templates. Allows specifying project name, output directory, minSdk, and dry-run execution describe Analyzes an Android project to generate descriptive metadata. This command identifies and outputs the paths to JSON files that detail the project's structure, including build targets and their corresponding output artifact locations (e.g., APKs). This information enables other tools and commands to locate build artifacts efficiently docs Android documentation commands for searching and fetching developer documentation from the official knowledge base emulator Manage Android Virtual Devices (AVDs). Includes commands to start, stop, list, and view details about emulators help Shows the help of all commands info Print environment information including SDK location, connected devices, and configuration variables. Use specific fields to narrow the output init Initializes the environment for the Android CLI. Sets up required configurations, directories, and default skills install Install an Android Application (one or more APKs) to a connected device or emulator without activating any components using incremental optimizations for faster deployment than adb layout Returns the layout tree of an application run Build, deploy, and launch an Android application on a connected device or emulator screen Commands to view the device sdk Manage the Android SDK installation. Includes commands to install, update, remove, and list available and installed SDK packages skills Manage Android CLI skills. Includes commands to install, remove, list, and search for skills by keyword studio Android Studio commands update Update the Android CLI to the latest version
completion Usage: android completion [-h] [] Installs shell autocomplete configuration for the Android CLI in the current user profile
Options:
-h, --help Show the help message for this command
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for troubleshooting
-V, --version Print version information and exit
Positional Parameters:
<shell> If provided, print the given shell completion without
installing. Supported: bash, zsh
create Usage: android create [-h] [--application-id=PARAM] [--list] [--min-sdk=PARAM] [--name=PARAM] [--namespace=PARAM] [--output=PARAM] [] Create a new Android project from available templates. Allows specifying project name, output directory, minSdk, and dry-run execution
Options:
--application-id=PARAM The application ID for the application
(e.g. 'com.example.myapp')
-h, --help Show the help message for this command
--list List all available templates
--min-sdk=PARAM The 'minSdk' supported by the
application (default is defined in the
template)
--name=PARAM The name of the application (e.g. 'My
Application')
--namespace=PARAM The namespace for resources and package
name for Kotlin source files
-o, --output=PARAM The destination project directory path
(default is '.')
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for
troubleshooting
-V, --version Print version information and exit
Positional Parameters:
<template-name> The template name
describe Usage: android describe [-h] [--project_dir=PARAM] Analyzes an Android project to generate descriptive metadata. This command identifies and outputs the paths to JSON files that detail the project's structure, including build targets and their corresponding output artifact locations (e.g., APKs). This information enables other tools and commands to locate build artifacts efficiently
Options:
-h, --help Show the help message for this command
--project_dir=PARAM The project directory to describe
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for troubleshooting
-V, --version Print version information and exit
docs Usage: android docs [-h] [COMMAND] Android documentation commands for searching and fetching developer documentation from the official knowledge base
Options:
-h, --help Show the help message for this command
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for troubleshooting
-V, --version Print version information and exit
Commands:
fetch Fetch an Android documentation article from a URL (kb://...)
search Search Android documentation. Enclose keywords in quotes
emulator Usage: android emulator [-h] [COMMAND] Manage Android Virtual Devices (AVDs). Includes commands to start, stop, list, and view details about emulators
Options:
-h, --help Show the help message for this command
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for troubleshooting
-V, --version Print version information and exit
Commands:
create Creates a virtual device
list Lists available virtual devices
remove Delete a virtual device
start Launches the specified virtual device. This command will
return when the emulator is fully started and ready to use
stop Stops the specified virtual device
help Usage: android help [-h] [COMMAND] Shows the help of all commands
Options:
-h, --help Show the help message for this command
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for troubleshooting
-V, --version Print version information and exit
Positional Parameters:
COMMAND The command to show help for
info Usage: android info [-h] [] Print environment information including SDK location, connected devices, and configuration variables. Use specific fields to narrow the output
Options:
-h, --help Show the help message for this command
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for troubleshooting
-V, --version Print version information and exit
Positional Parameters:
<field> The specific field to print the value of. If omitted print
all
init Usage: android init [-h] Initializes the environment for the Android CLI. Sets up required configurations, directories, and default skills
Options:
-h, --help Show the help message for this command
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for troubleshooting
-V, --version Print version information and exit
install Usage: android install [-h] [--apks=PARAM] [--device=PARAM] [--install-options=PARAM] [--use-delta-install] Install an Android Application (one or more APKs) to a connected device or emulator without activating any components using incremental optimizations for faster deployment than adb
Options:
--apks=PARAM The paths to the APKs, comma separated
--device=PARAM The device serial number
-h, --help Show the help message for this command
--install-options=PARAM Additional options/flags to pass to
package manager install (e.g. -g,-d)
--use-delta-install Use fast delta install (speeds up
incremental updates by transferring
only modified code and resources;
default: true)
android options:
--sdk=PARAM Path to the Android SDK
-v, --verbose Enable verbose output for
troubleshooting
-V, --version Print version information and exit