Licences for Android build tools not accepted

@HereIsJohnny, where should I input the dependencies? I tried this, but not work
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-26-alpha
environment:
JVM_OPTS: -Xmx3200m
dependencies:
override:
- echo y | android update sdk --no-ui --all --filter build-tools-26.0.2,android-26
steps:

I’m on Circle CI 2.0 with a circleci/android:api-26-alpha image and a build step that installs the NDK bundle:

- run: sdkmanager --install "ndk-bundle" && yes | sdkmanager --licenses

I’m seeing the following, followed by an immediate build failure:

[=============================          ] 75% Computing updates...              
[=============================          ] 75% Computing updates...              
[=======================================] 100% Computing updates...             
All SDK package licenses accepted.

Exited with code 141

The docker image itself looks fine to me so I’m not really sure what could be causing it.

Has anyone found a workable solution for the time being?


SOLUTION: I have solved my issue. For others, the command needs to be split up into two separate run statements.

Does not work

- run: sdkmanager --install "ndk-bundle" && yes | sdkmanager --licenses

Works

- run: sdkmanager --install "ndk-bundle"
- run: sdkmanager --licenses
1 Like

What’s the error msg? Seems like you put it in the correct place.

Here is the full .yml file:

dependencies:
  override:
    - echo y | android update sdk --no-ui --all --filter build-tools-26.0.2,android-26

machine:
  environment:
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m  -XX:+HeapDumpOnOutOfMemoryError"'
    _JAVA_OPTIONS: "-Xms512m -Xmx1024m"
  java:
    version: oraclejdk8


test:
  override:
    - java -jar checkstyle-7.2-all.jar -c ./google_checks.xml `find . -name "*.java" | grep "/src/"`
    - (./gradlew build):
        timeout: 360

  post:
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

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.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:splashActivity’.

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

I am getting the same error.
My circle.yml looks like:

machine:
environment:
GRADLE_OPTS: ‘-Dorg.gradle.jvmargs=“-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError”’

dependencies:
pre:
- echo y | android update sdk --no-ui --all --filter “tools,android-27,build-tools-26.0.2,platform-tools,extra-android-m2repository,extra-google-m2repository,extra-google-google_play_services”

cache_directories:
- /usr/local/android-sdk-linux/platforms/android-27
- /usr/local/android-sdk-linux/build-tools/26.0.2
- /usr/local/android-sdk-linux/extras/android/m2repository
test:
override:
# run unit tests
- ./gradlew test --continue -PpreDexEnable=false
# Just run unit tests on circleci, for instrumentation testing we currently use Local device
- cp -r splashActivity/build/outputs $CIRCLE_ARTIFACTS

There is an ugly workaround for this: Need to accept license agreement for Android tools?

Real fix must come from CircleCI. Until last Friday, updating Android SDK to 27 in pre was enough. Yesterday all the projects I’m working with right now got broken with no change at all.

For now, it seems you’ll have to do this ugly workaround to get your builds working again.

Using expect solved my problem.

thanks: http://vgaidarji.me/blog/2017/05/31/automatically-accept-android-sdkmanager-licenses/

This is very frustrating. Having the same issue and couldn’t find a solution… My config file:

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-21-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
#      - run:
#         name: Chmod permissions #if permission for Gradlew Dependencies fail, use this. 
#         command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Run Compile
          command: ./gradlew :clean :nachos:test
      - store_test_results:
          path: app/build/test-results

Can anyone help? It is really hard to evaluate a tool if you can’t event do a basic setup properly.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.