Install-missing-android-tools failing on license

The install-missing-android-tools build step started failing this morning when it gets to accepting licenses for build-tools 28.0.3. We upgraded our system for Android Studio 2.3.3 a few days ago.

Ensure required Android SDK components
Retrying...
Failed to ensure android components, error: output: Running exec java -Dorg.gradle.appname=gradlew - classpath /bitrise/src/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain dependencies --stacktrace
Parallel execution is an incubating feature.
> Configure project :hbmx
Checking the license for package Android SDK Build-Tools 28.0.3 in /opt/android-sdk-linux/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':hbmx'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
4 Likes

We went from 3.3.0-rc03 straight to 3.4.0-beta01 and now we are seeing this. Rolling back to 3.3.0-rc03 didn’t actually fix the problem.

Running into the same issue with this PR which upgrades Gradle from 3.1.4 to 3.3.0. My logs look pretty similar. This also happens if I change compileSdkVersion from 27 to 28.

I tried seeing if the issue was in the Dockerfile, but it looks like it’s correctly set to accept the license for build-tools 28.0.3: https://github.com/bitrise-docker/android/blob/master/Dockerfile#L63

This started impacting our Android build today as well, and we haven’t changed anything about our build config/tools recently.

It looked to me similar to this old issue from a year ago. The comments there led me to look at https://dl.google.com/android/repository/repository2-1.xml where it appears that the Android license was updated at 2019-01-18 13:05:43.965908 (yesterday). Our previous successful build was 3 days ago, so this seems potentially related.

The weird thing is that I would expect the current Docker image to still work, given the PR that resolved the previous issue which appears to accept all licenses. I wonder if something changed about the sdkmanager tool.

I started trying to work around the problem briefly, but then I found this thread. I hope this can be resolved soon.

From what I can see indeed the main part of the issue is the same as in the old one. android-sdk-license license has changed.

As a workaround you can add script step with content like this before install-missing-android-tools step:
yes |sdkmanager --install "build-tools;28.0.3"
It will accept the license for both build tools 28.0.3 and platform 28.
Or you can write the following content to $ANDROID_HOME/licenses/android-sdk-license:

8933bad161af4178b1185d1a37fbf41ea5269c55

d56f5187479451eabf01fb78af6dfcb131a6481e

24333f8a63b6825ea9c5514f83c2829b004d1fee

Another option (if it is suitable for your project) is to switch to normal (non-LTS) stack. It has those components preinstalled.

Commands from Dockerfile are executed when docker image is built, not on each app build.

The difference from previous issue is that sdkmanager --licenses won’t accept the new license. So there is more work needed to properly fix the step.

5 Likes

Thanks, @koral! I totally whiffed on the fact that the Docker build wouldn’t get regenerated. We switched to LTS after that NDK issue broke our build a few months ago, and it looks like other subsequent changes to our build config have made it possible for us to go back to the non-LTS image. I ran a successful build that I just need to go test out.

2 Likes

Thanks @koral. Here is text to copy/paste into your bitrise.yml to easily implement @koral’s workaround

- script@1.1.5:
        inputs:
        - content: |-
            #!/usr/bin/env bash
            yes |sdkmanager --install "build-tools;28.0.3"
            # TEMP solution to accept latest build tools licenses
            # see http://discuss.bitrise.io/t/install-missing-android-tools-failing-on-license/7749/5

Hi all!
Thank you for the report and your patience.
There is a new release (version 2.3.5: https://github.com/bitrise-steplib/steps-install-missing-android-tools/releases/tag/2.3.5) of install-missing-android-tools currently rolling out. Should be available everywhere by end of day.
The root cause was this google issue, which had to be worked around: https://issuetracker.google.com/issues/123054726

1 Like

Thanks, the fixed install-missing-android-tools works for me. :slight_smile:

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