我的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
我应该删除一个特定的部分吗?
我通过使用SDK的sdk-manager
来安装平台和构建工具,而不是Travis的Android组件,解决了这个问题。请参阅https://medium.com/@fawwazyusran/how-to-travis-ci-working-for-android-api-level-28-2fde7292813c上的帖子获取完整的教程。