Accept license for Android Build Tools 27.0.3 bug



I was going to report this bug on Github but you guys redirect people to this place. There is no “bug” category so I feel a little bit confused. Hope you can handle the bug report from here. Thanks in advance.

We are using Travis for our Android app as part of our CI & CD pipeline. We updated the Android Gradle Plugin to 3.3.0-alpha03 which is using the buildToolsVersion 28.0.3 and after building the project in our CI it failed complaining about a license not being accepted for the build tools 27.0.3.

As the documentation says:

By default, Travis CI will accept all the requested licenses

That means we shouldn’t handle anything at all whenever we update the build-tools. We wouldn’t even need to define a whitelist of licenses to be accepted, in theory:

    - 'android-sdk-preview-license-52d11cd2'
    - 'android-sdk-license-.+'
    - 'google-gdk-license-.+'

I tried many many things. From adding the previous snippet to the Travis YAML to copying and echoing licenses manually:

- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"

and other solutions from the StackOverflow community, and none worked.

Only a solution worked at first:

- yes | sdkmanager --update &>/dev/null
- yes | sdkmanager --licenses &>/dev/null

But this is basically updating all the things everytime we create a build so it takes about 50 seconds. It shouldn’t be necessary.

It finally came to my head; why is it failing to accept the license for build tools 27.0.3 when I’m using 28.0.3. Apparently by using:

  - yes | sdkmanager "build-tools;27.0.3"

it solves the problem, so there might be a bug on the Travis side because it should be doing that automatically, doesn’t it?

Thank you so much!