Builds failing - not accepting license agreements

Checking the license for package Android SDK Build-Tools 25.0.2 in /opt/android-sdk-linux/licenses
Warning: License for package Android SDK Build-Tools 25.0.2 not accepted.
FAILURE: Build failed with an exception.

  • What went wrong:

You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 25.0.2].

Our Android builds started failing 2 days ago. What’s wrong?

Most likely duplicate of Steps-install-missing-android-tools failing - 'You have not accepted the license agreements of the following SDK components:'

Did you try to upgrade the step?

If the step upgrade would not solve it, please include the whole log / build url! :blush:

We’re not using the step upgrade component in our projects. These are the scripts we’re using:

#!/bin/bash
# fail if any commands fails
set -e
# debug log
set -x

rsync -avhP ./android-licenses/ "$ANDROID_HOME/licenses/"

and:

#!/bin/bash
./gradlew dependencies || true

Is there a way we can send you our build log directly? We do not want to post it publicly.

It seems that you have old license hash.
You can either update it (here are the current hashes: https://github.com/bitrise-steplib/steps-install-missing-android-tools/commit/7b4120f2f7ed72949f97c8a943ded9cbfc48f803#diff-7ddfb3e035b42cd70649cc33393fe32cR77) or accept all the licenses like that:

#!/bin/bash
yes | sdkmanager --licenses
1 Like

@koral 's right, or use our Install Missing Android Tools step, which does exactly this (installs these dependencies and accepts the license) :wink:

Not completely. Install Missing Android Tools step contains hardcoded license hashes. If Google changes license build will start to fail again until new version of the step is released and users update their workflows (if they are not using alwayst latest version).

OTOH sdkmanager --licenses will accept all the current licenses at the time of invocation, no need to update anything. The only edge case can occur if license is changed in the short time window between “Accept licenses” and compilation (e.g. Gradle Runner) steps.

An update for the step is scheduled for next week to remove the hash based solution @koral :wink:

Tldr the complication was the LTS stack, which has older Android tools and no sdkmanager, so we rolled out a quickfix and scheduled a revision for next week :blush:

1 Like

We were able to resolve this problem by accepting all licenses as follows:

Thanks!

@koral We’re getting this issue now and the build is failed. We’re using node version 12.18 and running in Xcode 11.7.x, on macOS 10.15.6 (Catalina)

Failed to install licenses using $(sdkmanager --licenses) command
Continue using legacy license installation…
Ensure required Android SDK components
Retrying…
Failed to ensure android components, error: output: Configuration on demand is an incubating feature.

is the solution below valid still. If yes, where should i enter these values.

#!/bin/bash
yes | sdkmanager --licenses

I’m new to bitrise. Can you pls advise as it is quite important to resolve at the earllest.

It’s still valid.
You should enter it in a script step somewhere before your build step.

@koral
Thanks a lot for helping out. That license issue got fixed, but it throws the following error

Task :app:stripReleaseDebugSymbols FAILED
WARNING: Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
Task :app:mergeDexRelease
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:stripReleaseDebugSymbols’

No version of NDK matched the requested version 21.0.6113669. Versions available locally: 21.4.7075529

Should i use android.ndkVersion in build.gradle? Is that the only problem here.