Travis CI显示Android Platform 28错误,但未在yml文件中的任何地方提及

时间:2019-01-30 08:57:53

标签: android travis-ci build-error

据我所知,仅我的Travis配置仅使用API​​级别27和构建工具版本27.0.3。但是由于某种原因,Travis构建失败,因为它不接受Android SDK 28 和构建工具 28.0.3 许可。我从未在.travis.yml文件中指定这些版本。

language: android
sudo: required
jdk: oraclejdk8

env:
  global:
  - ANDROID_API_LEVEL=27
  - ANDROID_BUILD_TOOLS_VERSION=27.0.3
  - ANDROID_ABI=armeabi-v7a

android:
  components:
    - tools
    - platform-tools
    - tools # appears twice as per Travis docs
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_API_LEVEL
    - extra-android-m2repository
  licenses:
    - 'android-sdk-preview-license-52d11cd2'
    - 'android-sdk-license-.+'
    - 'google-gdk-license-.+'

before_install:
  - touch $HOME/.android/repositories.cfg

before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock

cache:
  directories:
  - $HOME/.gradle/caches/
  - $HOME/.gradle/wrapper/
  - $HOME/.android/build-cache

before_script:
  - chmod +x gradlew

script:
  - ./gradlew clean build
  - ./gradlew test

travis错误是:

> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

我应该删除特定的部分吗?

1 个答案:

答案 0 :(得分:0)

我通过使用SDK的sdk-manager而不是Travis的Android组件来安装平台和构建工具来解决此问题。有关完整的教程,请参见https://medium.com/@fawwazyusran/how-to-travis-ci-working-for-android-api-level-28-2fde7292813c上的帖子。