Travis CI + Android:不接受许可证(构建超时)

时间:2019-06-25 23:21:52

标签: android travis-ci

当我推送到远程Travis CI时,它开始构建,但是由于不接受许可证,它从未完成。我到达Travis构建中的Accept? (y/N):行,它等待直到超时。

Travis文件:

sudo: required
language: android
jdk: oraclejdk8
dist: trusty
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 "\    " > "$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:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
  directories:
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
    - $HOME/.android/build-cache

关于为什么它从不接受许可证的任何建议?

1 个答案:

答案 0 :(得分:0)

只需将- yes | sdkmanager --licenses >/dev/null添加到您的 before_install 阶段即可。