android - 特拉维斯-CI `Android 28 licenses have not been accepted`

标签 android gradle build yaml travis-ci

我正在尝试使用 Travis 使用 android-28build-tools-28.0.0 构建 android 项目,但无论我做什么,我都会得到

>Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-28 Android SDK Platform 28
     build-tools;28.0.0 Android SDK Build-Tools 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

在编译期间。

我试过了:

  • 添加:
    components:
      - build-tools-28.0.0
      - android-28
    
  • 通过以下方式安装:
    echo y | android update sdk --no-ui --filter build-tools-28.0.0,android-28,extra-android-m2repository
    
  • 使用以下方式接受许可:
    yes | sudo $ANDROID_HOME/tools/bin/sdkmanager --licenses
    
  • 使用以下方式接受许可:
    licenses:
      - 'android-sdk-preview-license-52d11cd2'
      - 'android-sdk-license-.+'
      - 'google-gdk-license-.+'
    
  • 甚至手动写入 $ANDROID_SDK/licenses 内的文件。

我很确定 2 周前它工作完全正常,但现在它每次都抛出这个错误。

PR in question这样您就可以查看错误、构建和文件。

最佳答案

将以下代码添加到您的 .travis.yml 文件中

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

before_install:
  - chmod +x gradlew
  - mkdir "$ANDROID_HOME/licenses" || true
  - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
  - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
  - yes | sdkmanager --update
  - yes | sdkmanager --licenses

关于android - 特拉维斯-CI `Android 28 licenses have not been accepted`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52274229/

相关文章:

java - 将数据存储到 Parse 中时出现问题 - 使用 TextView

java - 由于 'fatJar task',Gradle 构建失败,尽管代码在另一个项目中对我有用

java - Gradle构建:从Spring Boot Jar文件中排除资源文件

maven - 如何将 Spring Boot 构建插件与 JavaFX 应用程序一起使用

c++ - 为什么 Visual Studio 会生成这些附加文件?

android - Espresso 测试机器人

android - 如何在应用程序中随机显示对话框

android - 循环通过id访问资源

android - 如何找出在 Android Studio/Gradle 中的库中添加了多少方法

android - 从 react-native 项目中导出 APK