Automatically install Android dependencies in CI

Sdkmanager

Not long ago Google deprecated android command and executing it in command line we get next output:

deprecated android command

It’s advised to use new command sdkmanager.

We can install Android dependencies from command line using sdkmanager command. But before installation developer must accept licenses. On a local machine it’s easy, just run sdkmanager --licenses command and type y few times (up to ~6 licenses).

On remote machine (usually in CI), where the goal is to automate everything, would be perfect to accept licenses automatically.

Here’s a simple script which can be executed in order to accept all sdkmanager licenses:

Auto install Android dependencies

When you run a build from the command line, Gradle can automatically download missing SDK packages that a project depends on, as long as the corresponding SDK license agreements have already been accepted using the SDK Manager.

New functionality from Gradle provides this possibility to install Android dependencies automatically.

We need to add android.builder.sdkDownload=true property to gradle.properties file in project root.


As result, we should not care anymore about Android dependencies management in CI server as they will be installed automatically.

comments powered by Disqus