Travis CI 失败,因为无法接受许可证约束布局

2023-12-28

在我写这个问题之前,我已经搜索过同样的问题,他们确实有导出许可证,因为仍然使用 alpha 版本的约束布局。但现在android已经发布了约束布局的稳定版本。我尝试了很多设置但仍然失败。

我最新的.travis.yml

language: android

jdk: oraclejdk8

android:
  components:
    - platform-tools
    - tools # to get the new `repository-11.xml`
    - tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
    - build-tools-25.0.0
    - android-25

    # Additional components
    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository

  licenses:
    - 'android-sdk-preview-license-52d11cd2'
    - 'android-sdk-license-.+'
    - 'google-gdk-license-.+'

script:
   - ./gradlew clean build

这是我的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'
    defaultConfig {
        applicationId "com.package.my"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 6
        versionName "1.3.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.firebase:firebase-database:10.2.0'
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    compile 'com.firebaseui:firebase-ui-database:1.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    compile 'com.android.support:design:25.0.0'
    compile 'org.sufficientlysecure:html-textview:3.2'
    compile 'com.android.support:recyclerview-v7:25.2.0'

}

apply plugin: 'com.google.gms.google-services'

通过这个设置我得到了这个错误

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
  [ConstraintLayout for Android 1.0.1, Solver for ConstraintLayout 1.0.1].
  Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
  Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 55.975 secs
The command "./gradlew clean build" exited with 1.
Done. Your build exited with 1.

有没有使用出口许可证的解决方案?


更新回复

有没有使用出口许可证的解决方案?

是的,您可以使用新的sdkmanager to 安装约束库并接受许可证 https://travis-ci.org/albodelu/constraint-layout/jobs/220841506#L1601:

  - echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
  - echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"

否则,缺失的组件将被检测到gradle并下载而不接受:

  # Show version and download Gradle Wrapper if it's not already cached
  - cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew --version
  # Clean project and download missing dependencies and components
  - cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew clean build

在这种情况下,如下所述,您需要通过解决方法首次接受许可证。

使用 Android API 级别 22 至 25 的约束布局 Codelab 存储库的完整工作示例: https://travis-ci.org/albodelu/constraint-layout/builds/220841505

language: android
jdk: oraclejdk8
sudo: required # false for Container-Based Infrastructure, required for Sudo-enabled Infrastructure

before_cache:
  - rm -f ${TRAVIS_BUILD_DIR}/gradle/caches/modules-2/modules-2.lock # Avoid to repack it due locks
  - rm -f ${TRAVIS_BUILD_DIR}/gradle/caches/3.3/classAnalysis/classAnalysis.lock
  - rm -f ${TRAVIS_BUILD_DIR}/gradle/caches/3.3/jarSnapshots/jarSnapshots.lock

cache:
  directories:
    - ${TRAVIS_BUILD_DIR}/gradle/caches/
    - ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/

notifications:
  email: false

android:
  components: # Cookbooks version: https://github.com/travis-ci/travis-cookbooks/tree/9c6cd11
    - tools # Update preinstalled tools from revision 24.0.2 to 24.4.1
    - build-tools-25.0.2 # Match build-tools version used in build.gradle
    - platform-tools # Update platform-tools to revision 25.0.3+
    - tools # Update tools from revision 24.4.1 to 25.2.5

env:
  global:
    - DIR=constraint-layout-start # Project directory
    - API=25 # Android API level 25 by default
    - TAG=google_apis # Google APIs by default, alternatively use default
    - ABI=armeabi-v7a # ARM ABI v7a by default
    - QEMU_AUDIO_DRV=none # Disable emulator audio to avoid warning
    - GRADLE_USER_HOME="${TRAVIS_BUILD_DIR}/gradle" # Change location for Gradle Wrapper and cache
    - ANDROID_HOME=/usr/local/android-sdk-24.0.2 # Depends on the cookbooks version used in the VM
    - TOOLS=${ANDROID_HOME}/tools # PATH order matters, exists more than one emulator script
    - PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
    - ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)

matrix:
  include: # More Emulator API levels to build in parallel
    - env: API=24
    - env: API=23
    - env: API=22
  allow_failures:
    - env: API=23
    - env: API=22
  fast_finish: false

before_install:
  - export EMULATOR="system-images;android-${API};${TAG};${ABI}" # Used to install/create emulator
  - echo 'count=0' > /home/travis/.android/repositories.cfg # Avoid warning

install:
  # List and delete unnecessary components to free space
  - sdkmanager --list || true
  - sdkmanager --uninstall "system-images;android-15;default;armeabi-v7a"
  - sdkmanager --uninstall "system-images;android-16;default;armeabi-v7a"
  - sdkmanager --uninstall "system-images;android-17;default;armeabi-v7a"
  - sdkmanager --uninstall "system-images;android-18;default;armeabi-v7a"
  - sdkmanager --uninstall "system-images;android-19;default;armeabi-v7a"
  - sdkmanager --uninstall "system-images;android-21;default;armeabi-v7a"
  - sdkmanager --uninstall "extras;google;google_play_services"
  - sdkmanager --uninstall "extras;android;support"
  - sdkmanager --uninstall "platforms;android-10"
  - sdkmanager --uninstall "platforms;android-15"
  - sdkmanager --uninstall "platforms;android-16"
  - sdkmanager --uninstall "platforms;android-17"
  - sdkmanager --uninstall "platforms;android-18"
  - sdkmanager --uninstall "platforms;android-19"
  - sdkmanager --uninstall "platforms;android-20"
  - sdkmanager --uninstall "platforms;android-21"
  - sdkmanager --uninstall "build-tools;21.1.2"
  # Update sdk tools to latest version and install/update components
  - echo yes | sdkmanager "tools"
  - echo yes | sdkmanager "platforms;android-25" # Latest platform required by SDK tools
  - echo yes | sdkmanager "platforms;android-${API}" # Android platform required by emulator
  - echo yes | sdkmanager "extras;android;m2repository"
  - echo yes | sdkmanager "extras;google;m2repository"
  - echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
  - echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
  - echo yes | sdkmanager "$EMULATOR" # Install emulator system image
  # Create and start emulator
  - echo no | avdmanager create avd -n acib -k "$EMULATOR" -f --abi "$ABI" --tag "$TAG"
  - emulator -avd acib -engine classic -no-window -camera-back none -camera-front none -verbose -qemu -m 512 &
  # Start adbd, wait for device connected and show android serial
  - adb wait-for-device get-serialno
  # Show version and download Gradle Wrapper if it's not already cached
  - cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew --version
  # Clean project and download missing dependencies and components
  - cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew clean build
  # Check components status
  - sdkmanager --list || true

before_script:
  # Wait for emulator fully-booted and disable animations
  - android-wait-for-emulator
  - adb shell settings put global window_animation_scale 0 &
  - adb shell settings put global transition_animation_scale 0 &
  - adb shell settings put global animator_duration_scale 0 &
  - sleep 30
  - adb shell input keyevent 82 &

script:
  # Run all device checks
  - cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew connectedCheck

after_script:
  # Show tests and lint results
  - cat ${TRAVIS_BUILD_DIR}/${DIR}/*/build/outputs/androidTest-results/connected/*
  - cat ${TRAVIS_BUILD_DIR}/${DIR}/*/build/reports/lint-results.xml

另外两个示例使用sdkmanager and avdmanager没有${DIR}解决方法:

  • Android 地图实用程序库 - Google https://travis-ci.org/albodelu/android-maps-utils/builds/220859379
  • 德克斯特图书馆 - Karumi https://travis-ci.org/albodelu/Dexter/builds/220847349

参考

相关官方文档使用 Gradle 自动下载缺失的包 https://developer.android.com/studio/intro/update.html#download-with-gradle

The 新模拟器 https://developer.android.com/studio/releases/emulator.html选项的解释见从命令行启动模拟器 https://developer.android.com/studio/run/emulator-commandline.html

avdmanager 在这里解释 https://developer.android.com/studio/command-line/avdmanager.html取代android avd since SDK工具版本25.3.0 https://developer.android.com/studio/releases/sdk-tools.html

sdkmanager 在这里解释 https://developer.android.com/studio/command-line/sdkmanager.html还增强了从命令行查看和接受所有许可证的功能


上一个回复:由于sdkmanager替换了android脚本

我对 Travis-ci 有点过时了,现在似乎需要额外的工作,所以最好检查一下:

  • 作为 tir38noticed https://github.com/travis-ci/travis-ci/issues/6653, android tool https://developer.android.com/studio/tools/help/android.html不再支持。相反,使用sdkmanager...

  • Open issue https://code.google.com/p/android/issues/detail?id=212128 and 解决方法 https://stackoverflow.com/a/40144426/1009132对于这个主题:

In your .travis.yml文件添加:

before_install:
  - mkdir "$ANDROID_HOME/licenses" || true
  - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
  - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"

不要忘记接受主上的所有许可证android object:

android:
  components:
    # ...
  licenses:
    - android-sdk-license-.+
    - '.+'
  • Another 相关问题 https://code.google.com/p/android/issues/detail?id=212128#c104和解决方法:

如果您收到“请使用 Android Studio 中的 SDK 管理器。”错误,您只需安装缺少的即可 使用 sdkmanager 命令行工具的组件:

echo y | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4"
echo y | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta"
  • 本文 https://medium.com/@oldergod/constraint-layout-and-circleci-travis-d50342696d2#.u98wf893w解释 Circle-ci 和 Travis-ci 的约束布局问题

  • 文档 https://developer.android.com/studio/command-line/sdkmanager.html#usage关于Android SDK工具包中提供的sdkmanager (25.2.3+)


过时的解决方案:在 android 脚本弃用之前

我不使用默认的 Travis-ci 脚本来安装 Android 组件并接受许可证,从这里 https://github.com/ardock/android-topeka/blob/acib/scripts/acib#L42:

# Install and update SDK
function install-and-update-sdk {
    # Keep SDK packages up-to-date (only missing suggested updates are installed).
    ( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk -u -t \
        ${UPDATE_PKGS:-'platform-tools,tools,extra-android-m2repository,extra-google-m2repository'}
    # Install or reinstall SDK packages (if empty, all packages are installed).
    ( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk -a -u -t \
        ${INSTALL_PKGS:-'build-tools-23.0.3,android-23'},${TARGET_PKGS:-}
}

如果您这样做,您可以同时接受所有许可证this https://github.com/ardock/iosched/blob/1f793d83ed995dbc72034e519f2c1bbd9fb13b81/.travis.yml#L365:

# THE SETUP STAGE
# ---------------
# If you comment out this section, Travis CI will install for you the components you define here.
# Check your project requirements and the components included by default on Travis-ci VM images.
# Check required: https://github.com/google/iosched/blob/master/doc/BUILDING.md
# Check defaults: http://docs.travis-ci.com/user/languages/android/#Pre-installed-components

android:
  components:
    # Check Android SDK tools: http://developer.android.com/tools/sdk/tools-notes.html
    # Check Android SDK Platform-tools: http://developer.android.com/tools/revisions/platforms.html
    # Comment the lines below if the latest revisions of Android SDK Tools are included by default.
    # - tools
    # - platform-tools
    # ...
  licenses:
    # Check licenses: http://docs.travis-ci.com/user/languages/android/#Dealing-with-Licenses
    # By default Travis will accept all the licenses, but it's also possible to define a white list:
    # White list current android-sdk-license revision.
    # - 'android-sdk-license-5be876d5'
    # White list all android-sdk-license revisions.
    # - 'android-sdk-license-.+'
    # White list all the licenses.
    - '.+'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Travis CI 失败,因为无法接受许可证约束布局 的相关文章

随机推荐

  • 为什么微调器中的 onNothingSelected 没有被调用?

    我有一个 Android Spinner 当用户在显示 Spinner 的选择面板时按 后退键 时 我想监听该事件 我已经实现了 OnItemSelectedListener 但按后退键时未调用 onNothingSelected Adap
  • Django 的 mod_wsgi 错误:从守护进程读取响应标头时超时

    我正在运行 Django 2 0 4 和 mod wsgi 4 5 20 当我尝试将站点部署到我们的开发环境时 出现错误 parature 奇怪的是 该站点部署在根目录下VirtualHost正在正常响应 Tue Apr 10 13 34
  • 如何在字段级别创建元注释?

    我有这个带注释的休眠类 Entity public class SimponsFamily Id TableGenerator name ENTITY ID GENERATOR table ENTITY ID GENERATOR TABLE
  • Python有效地找到多个多项式的局部最大值/最小值

    我正在寻找一种有效的方法来查找多个 gt 100万 但独立的四阶多项式的局部最小值给定 指定范围 边界 我有两个要求 R1 即使对于 100 万个不同的多项式方程也有效 R2 局部最小值精确到 0 01 即 2dp 这是我使用创建的一些代码
  • 按计划手动触发 GitHub 操作

    我想按计划手动触发 GitHub 操作 但出现以下代码并出现错误 name Update data on workflow dispatch schedule cron 0 5 30 我正在寻找如何正确执行此操作的解决方案 并且有两种选择
  • 我将如何实现一种简单的基于堆栈的编程语言

    我有兴趣通过实现基于堆栈的编程语言来扩展我的计算机编程知识 我正在寻求从哪里开始的建议 因为我打算让它具有类似 pushint 1 会将值为 1 的整数推送到堆栈顶部 并通过诸如 之类的标签进行流量控制L01 jump L01 到目前为止
  • 我的回收者视图上的问题

    我正在尝试显示 recyclerview 并从 firebase 检索数据 但在添加保存在 firebase 存储上的图像后遇到问题 滚动后关闭 我有另一个 recyclerview 它使用相同的数据库 但没有问题 你能给我解决这个问题吗
  • eclipse插件开发

    我想开发一个eclipse插件 哪一个是最好的开始方式 本教程 http www vogella de articles EclipsePlugIn article html是一个很好的起点 然后 您可以通过阅读一本最新的 Eclipse
  • 如何将 Shell 脚本中的部分字符串提取到变量中

    我正在尝试在 sh 中执行以下操作 这是我的文件 foo bar Tests run 729 Failures 0 Errors 253 Skipped 0 baz 如何将 4 个数字拉入 4 个不同的变量 我现在已经在 sed 和 awk
  • C# 用户定义的 CSV 映射到 POCO

    我有一个从串行 UDP TCP 源读取输入数据的系统 输入数据只是不同数据类型 例如 DateTime double int string 的 CSV 示例字符串可能是 2012 03 23 12 00 00 1 000 23 inform
  • 是否可以告诉自动映射器在运行时忽略映射?

    我正在使用 Entity Framework 6 和 Automapper 将实体映射到 dtos 我有这个型号 public class PersonDto public int Id get set public string Name
  • MathJax 方程换行

    嘿 如果包含的元素具有固定大小 有谁知道让 MathJax 自动换行方程的好方法 MathJax v2 0 现在包括针对长显示方程的自动 可选 换行 它是由linebreaks的部分HTML CSS您的配置块 请参阅MathJax 文档 h
  • 在 TypeScript 中解构对象时重命名剩余属性变量

    EDIT 我在github上开了一个与此相关的问题 https github com Microsoft TypeScript issues 21265 https github com Microsoft TypeScript issue
  • PostgreSQL 从 9.1 升级到 9.4 后性能下降

    将 Postgres 9 1 升级到 9 4 后 我的性能变得非常慢 下面是两个查询的示例 它们的运行速度明显慢得多 注意 我意识到这些查询可能可以被重写以更有效地工作 但是我主要担心的是升级到较新版本的 Postgres 后 它们的运行速
  • 差异化包装

    升级应用程序时 Test ServiceFabricApplicationPackage命令会对版本号未更改的每个代码包抛出错误 这表示内容已更改 即使代码未更改 我知道有一个功能可以创建部分包 但我无法使用它 我的问题是 如何检查代码包内
  • 如何在其他工作表的应用程序脚本中请求或获得谷歌电子表格访问权限?

    我正在为我的自定义函数编写 A 电子表格的应用程序脚本 并尝试使用从那里获取 B 电子表格中的值openUrl 然而 我得到了ERROR当我使用自定义函数时在电子表格中 在谷歌文档中 它说 如果您的自定义函数抛出错误消息 You do no
  • 使用powershell在其他域上查找“网络用户”?

    我想做的是 net user user1 DOMAIN 但是 我想为计算机未加入但可以访问的域执行此操作 用户分布在 DOMAIN1 和 DOMAIN2 中 我运行它的计算机已加入 DOMAIN1 但会在 DOMAIN2 上查找用户 这可以
  • 在 mongodb 的嵌套数组中插入数据[重复]

    这个问题在这里已经有答案了 可能的重复 MongoDB 更新嵌套数组中的字段 https stackoverflow com questions 9611833 mongodb updating fields in nested array
  • Safari 中的垂直居中

    我在 Safari 中使用 margin auto 0 时遇到垂直居中问题 在嵌套在带有 display inline flex 的 div 内的 div 上 它在 Firefox Chrome Opera 中工作得很好 但在 Safari
  • Travis CI 失败,因为无法接受许可证约束布局

    在我写这个问题之前 我已经搜索过同样的问题 他们确实有导出许可证 因为仍然使用 alpha 版本的约束布局 但现在android已经发布了约束布局的稳定版本 我尝试了很多设置但仍然失败 我最新的 travis yml language an