Travis-CI `Android 28 licenses have not been accepted`

杀马特。学长 韩版系。学妹 提交于 2020-05-14 14:41:10

问题


I'm trying to build android project using Travis using android-28 and build-tools-28.0.0 but no matter what I do I get

>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

during compiling.

I've tried:

  • adding:
    components:
      - build-tools-28.0.0
      - android-28
    
  • installing through:
    echo y | android update sdk --no-ui --filter build-tools-28.0.0,android-28,extra-android-m2repository
    
  • accepting licenses using:
    yes | sudo $ANDROID_HOME/tools/bin/sdkmanager --licenses
    
  • accepting licenses using:
    licenses:
      - 'android-sdk-preview-license-52d11cd2'
      - 'android-sdk-license-.+'
      - 'google-gdk-license-.+'
    
  • even manually writing to file inside $ANDROID_SDK/licenses.

I'm pretty sure that 2 weeks ago it was working completely normal, but now it just throwing this error everytime.

PR in question so you can look at errors, builds and files.


回答1:


Add code below to your .travis.yml file

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

or

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


来源:https://stackoverflow.com/questions/52274229/travis-ci-android-28-licenses-have-not-been-accepted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!