简体   繁体   English

Travis-CI Android SDK许可证问题

[英]Travis-CI Android SDK license problems

I'm trying to build my Android project with Travis and currently I'm getting error: 我正在尝试用Travis构建我的Android项目,目前我收到错误:

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. 我会很感激任何建议。

Here is build URL https://travis-ci.org/madsunrise/luna-mobile/jobs/325034903 and also I put travis.yml below 这是构建URL https://travis-ci.org/madsunrise/luna-mobile/jobs/325034903 ,我也把travis.yml放在下面

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

Replace 更换

- ANDROID_BUILD_TOOLS=27.0.2

by 通过

- ANDROID_BUILD_TOOLS=27.0.1

or add: 或添加:

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

to explicitly install the matching version and accept the license as commented here. 显式安装匹配版本并接受此处评论的许可证

Explanation 说明

Since Android Plugin for Gradle 3.0.0 (October 2017) Gradle 3.0.0安卓插件(2017年10月)

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. 因此,您现在可以删除android.buildToolsVersion属性。

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 . 您没有在此处指定版本,您明确安装了版本27.0.2,Gradle正在下载版本27.0.1而未接受此处所述的许可协议。

Alternatively add buildToolsVersion 27.0.2 to your app/build.gradle : 或者将buildToolsVersion 27.0.2添加到app / build.gradle

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.2"

Note 注意

Seems that it's possible to automatically accept all the licenses, and echo is no longer required: 似乎可以自动接受所有许可证,并且不再需要echo

- 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. 您可能仍需要根据您的设置将许可证文件复制到其他位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM