環境
項目 | 値 |
---|---|
Jenkins | 2.50 |
ANDROID_SDK_HOME | /var/lib/jenkins/android-sdk |
Android SDK Toolsのバージョン | 25.2.3 |
ジョブ実行時に発生するメッセージ
23:28:41 Checking the license for package SDK Patch Applier v4 in /var/lib/jenkins/android-sdk/licenses
23:28:41 Warning: License for package SDK Patch Applier v4 not accepted.
23:28:41 Checking the license for package Google Repository in /var/lib/jenkins/android-sdk/licenses
23:28:41 Warning: License for package Google Repository not accepted.
23:28:41 Checking the license for package Android Support Repository in /var/lib/jenkins/android-sdk/licenses
23:28:41 Warning: License for package Android Support Repository not accepted.
23:28:41
23:28:41 FAILURE: Build failed with an exception.
23:28:41
23:28:41 * What went wrong:
23:28:41 A problem occurred configuring project ':app'.
23:28:41 > You have not accepted the license agreements of the following SDK components:
23:28:41 [SDK Patch Applier v4, Android Support Repository, Google Repository].
23:28:41 Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
23:28:41 Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
SDK Patch Applier v4
、 Android Support Repository
、 Google Repository
の3つのライセンスに同意してないよ。となり、ジョブが失敗します。
メッセージの最後に http://d.android.com/r/studio-ui/export-licenses.html を参照して、別の機器でライセンスに同意してCI環境に持ち込めば良い。と書かれていますが、リンク先の文章が改訂されている様でその方法が記載されていませんでした。
エラーメッセージでググっるとこの手段で解決する方法が見つかりますが、現在では適さない方法になっていそうです。
Android SDK Tools の sdkmanagerでライセンスに同意する
${ANDROID_SDK_HOME}/bin/sdkmanager
からパッケージをインストールし、その際にライセンスに同意します。
パッセージの一覧表示
${ANDROID_SDK_HOME}/bin/sdkmanager --list
を実行すると、インストール済みのパッケージ、(インストールしていない)有効なパッケージ、更新候補のパッケージが表示されます。
-bash-4.2$ ./tools/bin/sdkmanager --list
Installed packages:
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;19.0.3 | 19.0.3 | Android SDK Build-Tools 19.0.3 | build-tools/19.0.3/
build-tools;21.1.0 | 21.1.0 | Android SDK Build-Tools 21.1 | build-tools/21.1.0/
build-tools;23.0.2 | 23.0.2 | Android SDK Build-Tools 23.0.2 | build-tools/23.0.2/
build-tools;24.0.3 | 24.0.3 | Android SDK Build-Tools 24.0.3 | build-tools/24.0.3/
build-tools;25.0.0 | 25.0.0 | Android SDK Build-Tools 25 | build-tools/25.0.0/
build-tools;25.0.1 | 25.0.1 | Android SDK Build-Tools 25.0.1 | build-tools/25.0.1/
build-tools;25.0.2 | 25.0.2 | Android SDK Build-Tools 25.0.2 | build-tools/25.0.2/
build-tools;25.0.3 | 25.0.3 | Android SDK Build-Tools 25.0.3 | build-tools/25.0.3/
extras;android;m2repository | 41.0.0 | Android Support Repository, re... | extras/android/m2repository/
extras;google;m2repository | 42.0.0 | Google Repository, rev 42 | extras/google/m2repository/
platform-tools | 25.0.3 | Android SDK Platform-Tools 25.0.3 | platform-tools/
platforms;android-23 | 3 | Android SDK Platform 23, rev 3 | platforms/android-23/
platforms;android-24 | 2 | Android SDK Platform 24, rev 2 | platforms/android-24/
platforms;android-25 | 3 | Android SDK Platform 25, rev 3 | platforms/android-25/
tools | 25.2.3 | Android SDK Tools 25.2.3 | tools/
Available Packages:
Path | Version | Description
------- | ------- | -------
add-ons;addon-g..._apis-google-15 | 3 | Google APIs
add-ons;addon-g..._apis-google-16 | 4 | Google APIs
add-ons;addon-g..._apis-google-17 | 4 | Google APIs
add-ons;addon-g..._apis-google-18 | 4 | Google APIs
add-ons;addon-g..._apis-google-19 | 20 | Google APIs
add-ons;addon-g..._apis-google-21 | 1 | Google APIs
add-ons;addon-g..._apis-google-22 | 1 | Google APIs
add-ons;addon-g..._apis-google-23 | 1 | Google APIs
add-ons;addon-g..._apis-google-24 | 1 | Google APIs
add-ons;addon-g...e_gdk-google-19 | 11 | Glass Development Kit Preview
build-tools;19.1.0 | 19.1.0 | Android SDK Build-Tools 19.1
build-tools;20.0.0 | 20.0.0 | Android SDK Build-Tools 20
build-tools;21.1.2 | 21.1.2 | Android SDK Build-Tools 21.1.2
build-tools;22.0.1 | 22.0.1 | Android SDK Build-Tools 22.0.1
build-tools;23.0.1 | 23.0.1 | Android SDK Build-Tools 23.0.1
build-tools;23.0.2 | 23.0.2 | Android SDK Build-Tools 23.0.2
build-tools;23.0.3 | 23.0.3 | Android SDK Build-Tools 23.0.3
build-tools;24.0.0 | 24.0.0 | Android SDK Build-Tools 24
build-tools;24.0.1 | 24.0.1 | Android SDK Build-Tools 24.0.1
build-tools;24.0.2 | 24.0.2 | Android SDK Build-Tools 24.0.2
build-tools;24.0.3 | 24.0.3 | Android SDK Build-Tools 24.0.3
build-tools;25.0.0 | 25.0.0 | Android SDK Build-Tools 25
build-tools;25.0.1 | 25.0.1 | Android SDK Build-Tools 25.0.1
build-tools;25.0.2 | 25.0.2 | Android SDK Build-Tools 25.0.2
build-tools;25.0.3 | 25.0.3 | Android SDK Build-Tools 25.0.3
build-tools;26.0.0 | 26.0.0 | Android SDK Build-Tools 26
build-tools;26.0.1 | 26.0.1 | Android SDK Build-Tools 26.0.1
build-tools;26.0.2 | 26.0.2 | Android SDK Build-Tools 26.0.2
build-tools;27.0.0 | 27.0.0 | Android SDK Build-Tools 27
cmake;3.6.4111459 | 3.6.4111459 | CMake 3.6.4111459
docs | 1 | Documentation for Android SDK
emulator | 26.1.4 | Android Emulator
extras;android;gapid;1 | 1.0.3 | GPU Debugging tools
extras;android;gapid;3 | 3.1.0 | GPU Debugging tools
extras;android;m2repository | 47.0.0 | Android Support Repository
extras;google;auto | 1.1 | Android Auto Desktop Head Unit...
extras;google;g...e_play_services | 46 | Google Play services
extras;google;instantapps | 1.1.0 | Instant Apps Development SDK
extras;google;m2repository | 58 | Google Repository
extras;google;m...t_apk_expansion | 1 | Google Play APK Expansion library
extras;google;market_licensing | 1 | Google Play Licensing Library
extras;google;simulators | 1 | Android Auto API Simulators
extras;google;webdriver | 2 | Google Web Driver
extras;m2reposi...ut-solver;1.0.0 | 1 | Solver for ConstraintLayout 1.0.0
extras;m2reposi...er;1.0.0-alpha2 | 1 | com.android.support.constraint...
extras;m2reposi...er;1.0.0-alpha3 | 1 | com.android.support.constraint...
extras;m2reposi...er;1.0.0-alpha4 | 1 | com.android.support.constraint...
extras;m2reposi...er;1.0.0-alpha5 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...er;1.0.0-alpha6 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...er;1.0.0-alpha7 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...er;1.0.0-alpha8 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...er;1.0.0-alpha9 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta1 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta2 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta3 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta4 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta5 | 1 | Solver for ConstraintLayout 1....
extras;m2reposi...ut-solver;1.0.1 | 1 | Solver for ConstraintLayout 1.0.1
extras;m2reposi...ut-solver;1.0.2 | 1 | Solver for ConstraintLayout 1.0.2
extras;m2reposi...nt-layout;1.0.0 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha2 | 1 | com.android.support.constraint...
extras;m2reposi...ut;1.0.0-alpha3 | 1 | com.android.support.constraint...
extras;m2reposi...ut;1.0.0-alpha4 | 1 | com.android.support.constraint...
extras;m2reposi...ut;1.0.0-alpha5 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha6 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha7 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha8 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha9 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta1 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta2 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta3 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta4 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta5 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...nt-layout;1.0.1 | 1 | ConstraintLayout for Android 1...
extras;m2reposi...nt-layout;1.0.2 | 1 | ConstraintLayout for Android 1...
lldb;2.0 | 2.0.2558144 | LLDB 2.0
lldb;2.1 | 2.1.2852477 | LLDB 2.1
lldb;2.2 | 2.2.3271982 | LLDB 2.2
lldb;2.3 | 2.3.3614996 | LLDB 2.3
ndk-bundle | 15.2.4203891 | NDK
patcher;v4 | 1 | SDK Patch Applier v4
platform-tools | 26.0.1 | Android SDK Platform-Tools
platforms;android-10 | 2 | Android SDK Platform 10
platforms;android-11 | 2 | Android SDK Platform 11
platforms;android-12 | 3 | Android SDK Platform 12
platforms;android-13 | 1 | Android SDK Platform 13
platforms;android-14 | 4 | Android SDK Platform 14
platforms;android-15 | 5 | Android SDK Platform 15
platforms;android-16 | 5 | Android SDK Platform 16
platforms;android-17 | 3 | Android SDK Platform 17
platforms;android-18 | 3 | Android SDK Platform 18
platforms;android-19 | 4 | Android SDK Platform 19
platforms;android-20 | 2 | Android SDK Platform 20
platforms;android-21 | 2 | Android SDK Platform 21
platforms;android-22 | 2 | Android SDK Platform 22
platforms;android-23 | 3 | Android SDK Platform 23
platforms;android-24 | 2 | Android SDK Platform 24
platforms;android-25 | 3 | Android SDK Platform 25
platforms;android-26 | 2 | Android SDK Platform 26
platforms;android-27 | 1 | Android SDK Platform 27
platforms;android-7 | 3 | Android SDK Platform 7
platforms;android-8 | 3 | Android SDK Platform 8
platforms;android-9 | 2 | Android SDK Platform 9
sources;android-15 | 2 | Sources for Android 15
sources;android-16 | 2 | Sources for Android 16
sources;android-17 | 1 | Sources for Android 17
sources;android-18 | 1 | Sources for Android 18
sources;android-19 | 2 | Sources for Android 19
sources;android-20 | 1 | Sources for Android 20
sources;android-21 | 1 | Sources for Android 21
sources;android-22 | 1 | Sources for Android 22
sources;android-23 | 1 | Sources for Android 23
sources;android-24 | 1 | Sources for Android 24
sources;android-25 | 1 | Sources for Android 25
sources;android-26 | 1 | Sources for Android 26
system-images;a...ult;armeabi-v7a | 4 | ARM EABI v7a System Image
system-images;a...-10;default;x86 | 4 | Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a | 5 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 5 | Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a | 2 | ARM EABI v7a System Image
system-images;a...ult;armeabi-v7a | 4 | ARM EABI v7a System Image
system-images;a...15;default;mips | 1 | MIPS System Image
system-images;a...-15;default;x86 | 4 | Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a | 5 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 5 | Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a | 4 | ARM EABI v7a System Image
system-images;a...16;default;mips | 1 | MIPS System Image
system-images;a...-16;default;x86 | 5 | Intel x86 Atom System Image
system-images;a...google_apis;x86 | 5 | Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a | 5 | ARM EABI v7a System Image
system-images;a...17;default;mips | 1 | MIPS System Image
system-images;a...-17;default;x86 | 3 | Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a | 5 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 5 | Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a | 4 | ARM EABI v7a System Image
system-images;a...-18;default;x86 | 3 | Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a | 5 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 5 | Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a | 5 | ARM EABI v7a System Image
system-images;a...-19;default;x86 | 6 | Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a | 31 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 31 | Google APIs Intel x86 Atom Sys...
system-images;a...-tv;armeabi-v7a | 3 | Android TV ARM EABI v7a System...
system-images;a...;android-tv;x86 | 3 | Android TV Intel x86 Atom Syst...
system-images;a...ult;armeabi-v7a | 4 | ARM EABI v7a System Image
system-images;a...-21;default;x86 | 5 | Intel x86 Atom System Image
system-images;a...;default;x86_64 | 5 | Intel x86 Atom_64 System Image
system-images;a...pis;armeabi-v7a | 23 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 23 | Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 | 23 | Google APIs Intel x86 Atom_64 ...
system-images;a...-tv;armeabi-v7a | 1 | Android TV ARM EABI v7a System...
system-images;a...;android-tv;x86 | 3 | Android TV Intel x86 Atom Syst...
system-images;a...ult;armeabi-v7a | 2 | ARM EABI v7a System Image
system-images;a...-22;default;x86 | 6 | Intel x86 Atom System Image
system-images;a...;default;x86_64 | 6 | Intel x86 Atom_64 System Image
system-images;a...pis;armeabi-v7a | 17 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 17 | Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 | 17 | Google APIs Intel x86 Atom_64 ...
system-images;a...-tv;armeabi-v7a | 12 | Android TV ARM EABI v7a System...
system-images;a...;android-tv;x86 | 12 | Android TV Intel x86 Atom Syst...
system-images;a...ear;armeabi-v7a | 6 | Android Wear ARM EABI v7a Syst...
system-images;a...ndroid-wear;x86 | 6 | Android Wear Intel x86 Atom Sy...
system-images;a...-23;default;x86 | 10 | Intel x86 Atom System Image
system-images;a...;default;x86_64 | 10 | Intel x86 Atom_64 System Image
system-images;a...pis;armeabi-v7a | 24 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 24 | Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 | 24 | Google APIs Intel x86 Atom_64 ...
system-images;a...;android-tv;x86 | 13 | Android TV Intel x86 Atom Syst...
system-images;a...fault;arm64-v8a | 7 | ARM 64 v8a System Image
system-images;a...ult;armeabi-v7a | 7 | ARM EABI v7a System Image
system-images;a...-24;default;x86 | 8 | Intel x86 Atom System Image
system-images;a...;default;x86_64 | 8 | Intel x86 Atom_64 System Image
system-images;a..._apis;arm64-v8a | 17 | Google APIs ARM 64 v8a System ...
system-images;a...pis;armeabi-v7a | 17 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 17 | Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 | 17 | Google APIs Intel x86 Atom_64 ...
system-images;a...s_playstore;x86 | 16 | Google Play Intel x86 Atom Sys...
system-images;a...;android-tv;x86 | 7 | Android TV Intel x86 Atom Syst...
system-images;a...ear;armeabi-v7a | 3 | Android Wear ARM EABI v7a Syst...
system-images;a...ndroid-wear;x86 | 3 | Android Wear Intel x86 Atom Sy...
system-images;a..._apis;arm64-v8a | 9 | Google APIs ARM 64 v8a System ...
system-images;a...pis;armeabi-v7a | 9 | Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 | 9 | Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 | 8 | Google APIs Intel x86 Atom_64 ...
system-images;a...s_playstore;x86 | 9 | Google Play Intel x86 Atom Sys...
system-images;a...;android-tv;x86 | 5 | Android TV Intel x86 Atom Syst...
system-images;a...ndroid-wear;x86 | 2 | Android Wear Intel x86 Atom Sy...
system-images;a...google_apis;x86 | 6 | Google APIs Intel x86 Atom Sys...
system-images;a...s_playstore;x86 | 5 | Google Play Intel x86 Atom Sys...
system-images;a...;android-tv;x86 | 1 | Android TV Intel x86 Atom Syst...
system-images;a...google_apis;x86 | 1 | Google APIs Intel x86 Atom Sys...
system-images;a...s_playstore;x86 | 1 | Google Play Intel x86 Atom Sys...
tools | 26.1.1 | Android SDK Tools
Available Updates:
ID | Installed | Available
------- | ------- | -------
extras;android;m2repository | 41.0.0 | 47.0.0
extras;google;m2repository | 42.0.0 | 58
platform-tools | 25.0.3 | 26.0.1
tools | 25.2.3 | 26.1.1
done
SDK Patch Applier v4 をインストール
Available Packages
のセクションを見ると、 patcher;v4
というのがあるので、ライセンス同意を求められている SDK Patch Applier v4
に相当とあたりをつけてインストールします。
-bash-4.2$ ./tools/bin/sdkmanager "patcher;v4"
loaded.
License android-sdk-license:
---------------------------------------
Terms and Conditions
This is the Android Software Development Kit License Agreement
〜 ライセンスの条項 が続く 〜
---------------------------------------
Accept? (y/N): y
done
最後に、 Accept? (y/N):
と同意を求められているので、y
を入力して同意します。同意後に、 ./tools/bin/sdkmanager --list
を再実行すると、 patcher;v4
が Installed packages
セクションに移動しているのを確認できます。
その他のライセンス同意
patcher;v4
に同意した後に、 Jenkinsのジョブを再実行したら、ライセンスの同意を求められなくなりました。それでいいのかな・・・
sdkmanager --licenses を使う
sdkmanager バージョンが上がると(試したのは 26.0.1 )には --licenses
オプションが追加され、ライセンスへの同意を一括で行えます。
-bash-4.2$ ./tools/bin/sdkmanager
Usage:
sdkmanager [--uninstall] [<common args>] [--package_file <file>] [<packages>...]
sdkmanager --update [<common args>]
sdkmanager --list [<common args>]
sdkmanager --licenses [<common args>]
In its first form, installs, or uninstalls, or updates packages.
By default, the listed packages are installed or (if already installed)
updated to the latest version.
--uninstall: uninstalled listed packages.
<package> is a sdk-style path (e.g. "build-tools;23.0.0" or
"platforms;android-23").
<package-file> is a text file where each line is a sdk-style path
of a package to install or uninstall.
Multiple --package_file arguments may be specified in combination
with explicit paths.
In its second form (with --update), all installed packages are
updated to the latest version.
In its third form, all installed and available packages are printed
out.
In its fourth form (with --licenses), show and offer the option to
accept licenses for all available packages that have not already been
accepted.
Common Arguments:
--sdk_root=<sdkRootPath>: Use the specified SDK root instead of the SDK
containing this tool
--channel=<channelId>: Include packages in channels up to <channelId>.
Common channels are:
0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary).
--include_obsolete: With --list, show obsolete packages in the
package listing. With --update, update obsolete
packages as well as non-obsolete.
--no_https: Force all connections to use http rather than https.
--proxy=<http | socks>: Connect via a proxy of the given type.
--proxy_host=<IP or DNS address>: IP or DNS address of the proxy to use.
--proxy_port=<port #>: Proxy port to connect to.
* If the env var REPO_OS_OVERRIDE is set to "windows",
"macosx", or "linux", packages will be downloaded for that OS.
のこの部分
In its fourth form (with --licenses), show and offer the option to
accept licenses for all available packages that have not already been
accepted.
実行して見ると
-bash-4.2$ ./tools/bin/sdkmanager --licenses
5 of 5 SDK package licenses not accepted.
Review licenses that have not been accepted (y/N)? y
1/5: License android-googletv-license:
---------------------------------------
Terms and Conditions
〜ライセンスの条項〜
14.7 This License Agreement, and your relationship with Google under this License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from this License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
August 15, 2011
---------------------------------------
Accept? (y/N): y
2/5: License android-sdk-license:
---------------------------------------
Terms and Conditions
と個別に同意を求められ、一つに同意 する/しない と次にライセンスが表示され、連続して行うことができます。