CircleCI未能接受Android SDK Platform 27的许可

时间:2018-02-23 04:14:07

标签: android circleci

我有以下配置,可以工作数月/年,但最近开始在android-27上失败

#
# Build configuration for Circle CI
#

general:
    artifacts:
        - /home/ubuntu/austin-feeds-me/app/build/outputs/apk/

machine:
    java:
        version: openjdk8
    environment:
        ANDROID_HOME: /usr/local/android-sdk-linux
        GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'

dependencies:
    pre:
        - echo y | android update sdk --no-ui --all --filter tools,platform-tools,android-27
        - echo y | android update sdk --no-ui --all --filter build-tools-26.0.2
        - echo y | android update sdk --no-ui --all --filter tools
        - echo y | android update sdk --no-ui --all --filter extra-android-m2repository
        - echo y | android update sdk --no-ui --all --filter extra-android-support
        - echo y | android update sdk --no-ui --all --filter extra-google-google_play_services
        - echo y | android update sdk --no-ui --all --filter extra-google-m2repository
    override:
        - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

test:
    override:
        - (./gradlew assemble):
            timeout: 360

当我的circleci作业现在运行时,即使我发送y到android update sdk命令,我也得到以下异常。

IDLE<=============> 100% CONFIGURING [31s]<=============> 100% CONFIGURING [32s]Checking the license for package Android SDK Platform 27 in /usr/local/android-sdk-linux/licenses
Warning: License for package Android SDK Platform 27 not accepted.



<=============> 100% CONFIGURING [32s]> IDLE> IDLE> IDLE

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:
  [Android SDK Platform 27].
  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.

* Get more help at https://help.gradle.org

BUILD FAILED in 43s

1 个答案:

答案 0 :(得分:0)

我最终迁移到CircleCi 2.0。下面是一个快速而又脏的circle.yml文件,用于android上的circleci 2.0:

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-27-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
      - run:
          name: Download Dependencies
          command: |
                  sudo chmod +x gradlew
                  ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Build Debug
          command: ./gradlew assembleDebug
      - store_artifacts:
          path: app/build/outputs/apk/debug/app-debug.apk
          destination: app-debug.apk
      - run:
          name: Uploading on Beta
          command: ./gradlew crashlyticsUploadDistributionDebug