Travis CI:超时时构建失败。许可证不被接受?

时间:2019-05-03 02:19:40

标签: android travis-ci

我的构建在Travis CI中失败。它不接受Android SDK许可证:

 $ sdkmanager "system-images;android-28;google_apis;x86"
 Warning: File /home/travis/.android/repositories.cfg could not be loaded.   
 License android-sdk-license:
 ---------------------------------------
 Terms and Conditions
    .
    .
    . //bunch of terms here
    .
    .
  Accept? (y/N): 

我的Travis yml文件:

sudo: required
language: android
jdk: oraclejdk8
android:
  components:
    - tools
    - tools
    - platform-tools
    - build-tools-28.0.3
    - android-28
    - add-on
    - extra
before_install:
    - echo yes | sdkmanager "build-tools;28.0.3"
    - echo yes | sdkmanager "platforms;android-28"
    - mkdir "$ANDROID_HOME/licenses" || true
    - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
    - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
    - sdkmanager "system-images;android-28;google_apis;x86"
    - echo no | avdmanager create avd --force -n emulatorApi28 -k "system-images;android-28;google_apis;x86"
    - emulator -avd test -no-audio -no-window &
    - ./gradlew dependencies || true
before_script:
    - android-wait-for-emulator
    - adb shell input keyevent 82 &
script:
    - ./gradlew build connectedCheck
    - "./gradlew clean build connectedCheck -PdisablePreDex --stacktrace"
before_cache:
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
    - $HOME/.android/build-cache
cache:
    directories:
        -$HOME/.gradle/caches/
        -$HOME/.gradle/wrapper/s
licenses:
    - 'android-sdk-preview-license-.+'
    - 'android-sdk-license-.+'
    - 'google-gdk-license-.+'

有什么建议吗?

编辑

sudo: required
language: android
jdk: oraclejdk8
android:
    licenses:
    - 'android-sdk-preview-license-.+'
    - 'android-sdk-license-.+'
    - 'google-gdk-license-.+' 
  components:
    - tools
    - tools
    - platform-tools
    - build-tools-28.0.3
    - android-28
    - add-on
    - extra
before_install:
    - echo y | sdkmanager "build-tools;28.0.3"
    - echo y | sdkmanager "platforms;android-28"
    - mkdir "$ANDROID_HOME/licenses" || true
    - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
    - echo -e "\    " > "$ANDROID_HOME/licenses/android-sdk-preview-license"
    - sdkmanager "system-images;android-28;google_apis;x86"
    - echo no | avdmanager create avd --force -n emulatorApi28 -k "system-images;android-28;google_apis;x86"
    - emulator -avd test -no-audio -no-window &
    - ./gradlew dependencies || true
before_script:
    - android-wait-for-emulator
    - adb shell input keyevent 82 &
script:
    - ./gradlew build connectedCheck
    - "./gradlew clean build connectedCheck -PdisablePreDex --stacktrace"
before_cache:
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
    - $HOME/.android/build-cache
cache:
    directories:
        -$HOME/.gradle/caches/
        -$HOME/.gradle/wrapper/sis?

1 个答案:

答案 0 :(得分:1)

看看documentationlicenses部分应该在android部分的下面。所以应该像这样:

android:
  components:
  ...
  licenses:
    - 'android-sdk-preview-license-.+'
    - 'android-sdk-license-.+'
    - 'google-gdk-license-.+'