2017-05-09 73 views
1

我想實現CI爲我的項目之一,每當特拉維斯運行它與下面的錯誤結束:特拉維斯Android的許可問題,

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

好的,所以多喝一點咖啡可以讓我的谷歌搜索更高效地解決了這個問題。詳細描述了該問題here。我不得不添加以下幾行代碼(仍然不明白我需要這個25,但至少它工作):

- build-tools-25.0.1 
- android-25 
+0

謝謝!同樣的邏輯適用於定位Android SDK 26和使用構建工具26.0.1。我嘗試了很多事情來接受缺少的許可證,我不知道爲什麼,但是添加這些組件解決了未被接受的許可證問題。 –