なんか、Android Studio入れるのはいまさらめんどくさいし、AI経由のコーディングをするにはCLIでなんとかしたいので、Android CLIを入れてみる。
Android CLI のリリースノート | Android Studio | Android Developers
https://developer.android.com/tools/agents/android-cli/release-notes?authuser=7&hl=ja
Homebrewにandroid/tapという追加リポジトリを登録してインストールできる。
% brew tap android/tap
==> Downloading Homebrew API data
✔︎ JSON API packages.arm64_sonoma.jws.json Downloaded 15.7MB/ 15.7MB
==> Tapping android/tap
Cloning into '/opt/homebrew/Library/Taps/android/homebrew-tap'...
Tapped 1 cask (15 files, 25.5KB).
% brew install android-cli
==> Would install 1 cask:
android-cli
Warning: The following taps are not trusted:
android/tap
Homebrew is currently ignoring formulae, casks and commands from these taps because tap trust is required.
Untap them with:
brew untap android/tap
Trust specific formulae, casks and commands with:
brew trust --formula <user>/<tap>/<formula>
brew trust --cask <user>/<tap>/<cask>
brew trust --command <user>/<tap>/<command>
Whole-tap trust is broader and includes all current and future formulae,
casks and commands from the listed taps. Trust whole taps with:
brew trust android/tap
To disable trust checks:
export HOMEBREW_NO_REQUIRE_TAP_TRUST=1
This is not recommended and will be removed in a later release.
For more information, see:
https://docs.brew.sh/Tap-Trust
==> Fetching downloads for: android-cli
✔︎ Cask android-cli (1.0.15985488) Downloaded 3.7MB/ 3.7MB
==> Installing Cask android-cli
==> Purging files for version 1.0.15985488 of Cask android-cli
Error: android-cli: It seems there is already a Binary at '/opt/homebrew/bin/android'.
なんか前に入れたコマンドラインビルドの環境名とぶつかっているみたい。そちらをアンインストールする。
% brew uninstall --cask android-commandlinetools
==> Uninstalling Cask android-commandlinetools
==> Backing up Generic Artifact 'latest' to '/opt/homebrew/Caskroom/android-comm
==> Removing Generic Artifact '/opt/homebrew/share/android-commandlinetools/cmdl
==> Unlinking Binary '/opt/homebrew/bin/apkanalyzer'
==> Unlinking Binary '/opt/homebrew/bin/avdmanager'
==> Unlinking Binary '/opt/homebrew/bin/d8'
==> Unlinking Binary '/opt/homebrew/bin/lint'
==> Unlinking Binary '/opt/homebrew/bin/profgen'
==> Unlinking Binary '/opt/homebrew/bin/retrace'
==> Unlinking Binary '/opt/homebrew/bin/screenshot2'
==> Unlinking Binary '/opt/homebrew/bin/sdkmanager'
==> Unlinking Binary '/opt/homebrew/bin/android'
==> Unlinking Binary '/opt/homebrew/bin/r8'
==> Unlinking Binary '/opt/homebrew/bin/resourceshrinker'
==> Purging files for version 15859902 of Cask android-commandlinetools
tap全体を信用するのはあんまりよくないという警告も出ていたので、CLIのみにしておく。
% brew install android/tap/android-cli
==> Auto-updating Homebrew...
Adjust how often this is run with `$HOMEBREW_AUTO_UPDATE_SECS` or disable with
`$HOMEBREW_NO_AUTO_UPDATE=1`. Hide these hints with `$HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Trusted cask android/tap/android-cli
==> Would install 1 cask:
android/tap/android-cli
==> Fetching downloads for: android/tap/android-cli
Warning: No checksum defined for cask 'android-cli', skipping verification..7MB
✔︎ Cask android-cli (latest) Downloaded 3.7MB/ 3.7MB
==> Installing Cask android-cli
==> Linking Binary 'android' to '/opt/homebrew/bin/android'
Downloading Android CLI...
🍺 android-cli was successfully installed!
==> Cleanup
==> android/tap/android-cli
Removing: /Users/y.date/Library/Caches/Homebrew/Cask/android-cli--latest... (3.7MB)
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
確認。
% which android
/opt/homebrew/bin/android
% android --version
Unpacking embedded installation...
Terms of Service and License Agreement for the Android Software Development Kit
https://developer.android.com/studio/terms
Google collects usage data for the Android CLI, such as commands, sub-commands, and flags used. This data does not include custom parameters or identifiable information. This information helps improve the tool and is collected in accordance with Google's Privacy Policy.
https://policies.google.com/privacy
Disable Android CLI metrics collection by using the --no-metrics flag.
1.0.15985488
% android info
sdk: /opt/homebrew/share/android-commandlinetools
version: 1.0.15985488
launcher_version: 1.0.15985488
SDKのインストールをする。
% android sdk install platforms/android-36 build-tools/36.0.0 platform-tools
% android sdk list 'platforms/android-36|build-tools/36.0.0|platform-tools'
Installed packages:
build-tools/36.0.0 36.0.0 Android SDK Build-Tools 36
platform-tools 37.0.1 Android SDK Platform-Tools
platforms/android-36 2.0.0 Android SDK Platform 36
AIエージェントからAndroid開発させる目的なら、Android CLI用のagent skillをセットアップしておくといいかも。
% android init
ううう、楽だ。Android Studioを入れて、いろいろ設定するより断然いいわ。
オリジナル投稿:
Android CLI環境を作成する|kinneko|pixivFANBOX
https://kinneko.fanbox.cc/posts/12509582


