LoginSignup
9
8

More than 5 years have passed since last update.

旧build-toolsを使う方法 〜Android コマンドが使いたい〜

Last updated at Posted at 2017-03-21

環境

Mac : 10.11.5(OS X El Capitan)

こんな人向け

Androidコマンドを使いたいのに、build-toolsを最新の25.3.0に上げてしまって使えなくて嘆いてる人向けです!

SDK Tools Release Notes

スクリーンショット 2017-03-21 13.54.56.png

2017/03/21の時点で最新のSDK Toolsのバージョンは25.3.0です。

今回のアップデートで色々と大きく変わったらしいのですが、個人的に困ったのは、

android avd command-line functionality replaced with new avdmanager tool.

以前は、

$ android avd

とコマンドラインから叩くと下図のようなADV Managerが開いてくれて便利だったのですが、それが使えない。

スクリーンショット 2017-03-21 13.46.45.png

旧バージョンのTools

androidコマンドが生きていた、旧SDK Tool 25.2.3の頃の androidのhelp

$ android --help

       Usage:
       android [global options] action [action options]
       Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

                                                                    Valid
                                                                    actions
                                                                    are
                                                                    composed
                                                                    of a verb
                                                                    and an
                                                                    optional
                                                                    direct
                                                                    object:
-    sdk              : Displays the SDK Manager window.
-    avd              : Displays the AVD Manager window.
-   list              : Lists existing targets or virtual devices.
-   list avd          : Lists existing Android Virtual Devices.
-   list target       : Lists existing targets.
-   list device       : Lists existing devices.
-   list sdk          : Lists remote SDK repository.
- create avd          : Creates a new Android Virtual Device.
-   move avd          : Moves or renames an Android Virtual Device.
- delete avd          : Deletes an Android Virtual Device.
- update avd          : Updates an Android Virtual Device to match the folders
                        of a new SDK.
- create project      : Creates a new Android project.
- update project      : Updates an Android project (must already have an
                        AndroidManifest.xml).
- create test-project : Creates a new Android project for a test package.
- update test-project : Updates the Android project for a test package (must
                        already have an AndroidManifest.xml).
- create lib-project  : Creates a new Android library project.
- update lib-project  : Updates an Android library project (must already have
                        an AndroidManifest.xml).
- create uitest-project: Creates a new UI test project.
- update adb          : Updates adb to support the USB devices declared in the
                        SDK add-ons.
- update sdk          : Updates the SDK by suggesting new platforms to install
                        if available.

最新版のTools

そして、SDK Tool 25.3.0で androidのhelp を叩くと

$ android --help
The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager

と表示されます。

そして、今回の目的として android avd が使いたく、使いたければ avdmanager を代わりに使えとのことなので、helpを叩いてみる

$ avdmanager --help

Usage:
      avdmanager [global options] [action] [action options]
      Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

Valid actions are composed of a verb and an optional direct object:
-   list              : Lists existing targets or virtual devices.
-   list avd          : Lists existing Android Virtual Devices.
-   list target       : Lists existing targets.
-   list device       : Lists existing devices.
- create avd          : Creates a new Android Virtual Device.
-   move avd          : Moves or renames an Android Virtual Device.
- delete avd          : Deletes an Android Virtual Device.

....だいぶ内容が変わってる。

そして、 android avd の代用となるようなコマンドが見当たらない。

......。

旧バージョンのSDK Toolsのダウンロードして入れ替えよう

https://developer.android.com/studio/index.html
2017/03/21の時点でSDK Tools 25.2.3 がダウンロードできました。

スクリーンショット 2017-03-21 13.56.40.png

ダウンロードが完了し、解凍を終えたら現在のtoolsを削除し、解凍したものを代わりに置きます。

因みに自分の環境だと以下の場所にありました。

/Users/<ユーザID>/Library/Android/sdk/tools

おわり

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8