Jenkins编译错误——you have not accepted the license agreements of the following SDK components:

jenkins自动化编译时,出现如下类似问题。

《Jenkins编译错误——you have not accepted the license agreements of the following SDK components:》 编译错误.png

根据提示是因为缺少Android SDK Platform 24.需要手动使用sdk命令行安装该库来解决。

从android-sdk 25.2.3开始google提供了新的工具sdkmanager来代替android命令。具体使用方法可参考续篇。 Jenkins编译错误——you have not accepted the license agreements of the following SDK components(二)

一、获取可安装的组件列表
//命令行输入
$android list sdk
[root@localhost workspace]# android list sdk
Refresh Sources:
  Fetching https://dl.google.com/android/repository/addons_list-2.xml
  Validate XML
  Parse XML
  Fetched Add-ons List successfully
  Refresh Sources
  Fetching URL: https://dl.google.com/android/repository/repository-11.xml
  Validate XML: https://dl.google.com/android/repository/repository-11.xml
  Parse XML:    https://dl.google.com/android/repository/repository-11.xml
  Fetching URL: https://dl.google.com/android/repository/addon.xml
  Validate XML: https://dl.google.com/android/repository/addon.xml
  Parse XML:    https://dl.google.com/android/repository/addon.xml
  Fetching URL: https://dl.google.com/android/repository/glass/addon.xml
  Validate XML: https://dl.google.com/android/repository/glass/addon.xml
  Parse XML:    https://dl.google.com/android/repository/glass/addon.xml
  Fetching URL: https://dl.google.com/android/repository/extras/intel/addon.xml
  Validate XML: https://dl.google.com/android/repository/extras/intel/addon.xml
  Parse XML:    https://dl.google.com/android/repository/extras/intel/addon.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Packages available for installation or update: 26
   1- Android SDK Tools, revision 25.2.5
   2- Android SDK Platform-tools, revision 25.0.3
   3- Documentation for Android SDK, API 24, revision 1
   4- SDK Platform Android 7.1.1, API 25, revision 3
   5- SDK Platform Android 7.0, API 24, revision 2
   6- Android TV Intel x86 Atom System Image, Android API 23, revision 8
   7- Android Wear ARM EABI v7a System Image, Android API 23, revision 6
   8- Google APIs, Android API 24, revision 1
   9- Google APIs, Android API 23, revision 1
  10- Google APIs, Android API 22, revision 1
  11- Google APIs, Android API 21, revision 1
  12- Google APIs, Android API 19, revision 20
  13- Glass Development Kit Preview, Android API 19, revision 11
  14- Google APIs, Android API 18, revision 4
  15- Google APIs, Android API 17, revision 4
  16- Google APIs, Android API 16, revision 4
  17- Google APIs, Android API 15, revision 3
  18- Android Support Repository, revision 43
  19- Android Auto Desktop Head Unit emulator, revision 1.1
  20- Google Play services, revision 38
  21- Google Repository, revision 43
  22- Google Play APK Expansion library, revision 1
  23- Google Play Licensing Library, revision 1
  24- Google Play Billing Library, revision 5
  25- Android Auto API Simulators, revision 1
  26- Google Web Driver, revision 2


//显示全部可安装列表.如果上述命令中未找到想要的工具
[root@localhost workspace]# android list sdk -a
二、下载安装。通过–filter选项,指定需要下载的组件。在提示接受license时,输入y即可完成下载安装。
[root@localhost workspace]# android update sdk --no-ui --filter 5
Refresh Sources:
  Fetching https://dl.google.com/android/repository/addons_list-2.xml
  Validate XML
  Parse XML
 ***************************省略***********************************
-------------------------------
License id: android-sdk-license-c81a61d9
Used by: 
 - SDK Platform Android 7.0, API 24, revision 2
-------------------------------

Terms and Conditions

This is the Android Software Development Kit License Agreement
***************************省略***********************************


November 20, 2015
Do you accept the license 'android-sdk-license-c81a61d9' [y/n]:

Installing Archives:
  Preparing to install archives
  Downloading SDK Platform Android 7.0, API 24, revision 2
  Installing SDK Platform Android 7.0, API 24, revision 2
    Installed SDK Platform Android 7.0, API 24, revision 296%)
  Done. 1 package installed.

//如果参数为全部可安装列表中的序号,需要加入-a参数
[root@localhost workspace]# android update sdk -a --no-ui --filter 5
    原文作者:zizi192
    原文地址: https://www.jianshu.com/p/4d980fc806dd
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞