Travis-CI Android SDK许可问题 [英] Travis-CI Android SDK license problems

查看:104
本文介绍了Travis-CI Android SDK许可问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Travis构建我的Android项目,当前出现错误:

I'm trying to build my Android project with Travis and currently I'm getting error:

A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK 
components:
[Android SDK Build-Tools 27.0.1].

我不知道如何,但是昨天我可以解决这个问题:

I don't know how, but yesterday I could solve problem with that:

before_install:
    - yes | sdkmanager "platforms;android-27"

但是现在对我没有帮助.我将不胜感激.

But now it doesn't help me. I will be grateful for any advice.

这是构建网址 https://travis-ci.org/madsunrise/luna-mobile/jobs/325034903 ,而且我在下面放了travis.yml

Here is build URL https://travis-ci.org/madsunrise/luna-mobile/jobs/325034903 and also I put travis.yml below

sudo: required

language: android
jdk: oraclejdk8

notifications:
  email:
    recipients:
      - rudnev.vanya@gmail.com
    on_success: change
    on_failure: always

before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -rf $HOME/.gradle/caches/*/plugin-resolution/

before_install:
  - yes | sdkmanager "platforms;android-27"

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

env:
 global:
 - ANDROID_API=27
 - ANDROID_BUILD_TOOLS=27.0.2

android:
 components:
  - tools
  - tools # Running this twice get's the latest build tools
  - platform-tools
  - android-${ANDROID_API}
  - build-tools-${ANDROID_BUILD_TOOLS}
  - extra

script:
   - ./gradlew clean test build

推荐答案

替换

- ANDROID_BUILD_TOOLS=27.0.2

作者

- ANDROID_BUILD_TOOLS=27.0.1

或添加:

- echo yes | sdkmanager "build-tools;27.0.1"

显式安装匹配版本并接受此处的评论.

to explicitly install the matching version and accept the license as commented here.

说明

适用于Gradle 3.0.0的Android插件(十月2017)

您不再需要为构建工具指定版本-插件 默认情况下使用最低要求的版本.因此,您现在可以删除 android.buildToolsVersion属性.

you no longer need to specify a version for the build tools—the plugin uses the minimum required version by default. So, you can now remove the android.buildToolsVersion property.

您未在此处指定版本>,您明确安装了版本27.0.2,并且Gradle正在下载版本27.0.1,而不接受此处所述的许可协议>.

You are not specifying a version here, you are explicitly installing version 27.0.2, and Gradle is downloading version 27.0.1 without accepting the license agreement as explained here.

或者将buildToolsVersion 27.0.2添加到您的 app/build .gradle :

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.2"

注意

似乎可以自动接受所有许可证,并且不再需要echo:

Seems that it's possible to automatically accept all the licenses, and echo is no longer required:

- yes | sudo sdkmanager --licenses

但是我没有测试它,请检查此问题以获取更多信息.

But I didn't test it, please check this question for further information.

您可能仍需要将许可证文件复制到其他位置 根据您的设置.

you might still need to copy the licence files to other locations based on your setup.

这篇关于Travis-CI Android SDK许可问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆