特拉维斯的Android许可证问题

时间:2017-05-09 14:12:48

标签: android continuous-integration travis-ci

我正在尝试为我的一个项目实施CI,每当travis运行时,它最终都会出现以下错误:

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Build-Tools 25.0.1, Android SDK Platform 25].
  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.
  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
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED

我经历过this questionthis example和其他一些人,但我无法弄清楚我做错了什么。

language: android
jdk:
  - oraclejdk8
sudo: true
before_install:
- chmod +x gradlew
env:
  global:
   - ANDROID_API_LEVEL=23
   - EMULATOR_API_LEVEL=21
   - ANDROID_BUILD_TOOLS_VERSION=23.0.1
   - ANDROID_ABI=armeabi-v7a
   - ANDROID_TAG=google_apis
   - ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
android:
  components:
    - tools
    - tools
    - platform-tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_API_LEVEL
    - android-$EMULATOR_API_LEVEL
    - extra
    - add-on
    - extra-google-m2repository
    - extra-android-m2repository

    # Google Play Services
    - extra-google-google_play_services
    # Support library
    - extra-android-support

    - addon-google_apis-google-$ANDROID_API_LEVEL
    - addon-google_apis-google-$EMULATOR_API_LEVEL

    - sys-img-armeabi-v7a-google_apis-$ANDROID_API_LEVEL
    - sys-img-armeabi-v7a-google_apis-$EMULATOR_API_LEVEL

  licenses:
    - 'android-sdk-preview-license-.+'
    - 'android-sdk-license-.+'
    - 'intel-android-extra-license.+'

before_script:
    - echo no | android create avd --force -n test -t "android-23" --abi $ANDROID_ABI --tag $ANDROID_TAG
    - emulator -avd test -no-window &
    - android-wait-for-emulator
    - adb shell input keyevent 82 &

如果有人需要有关该项目的更多详细信息,请参阅github page

1 个答案:

答案 0 :(得分:1)

好的,所以多一点咖啡让我的谷歌搜索更有效解决了这个问题。问题详细描述了{{3}}。我不得不在我的代码中添加以下行(仍然不明白我需要什么,但至少它有效):

- build-tools-25.0.1
- android-25