Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating default buildToolsVersion

According to the Android SDK Release Notes you no longer need to define the buildToolsVersion property in the project's build.gradle, as a default version is used

If you're using Android plugin for Gradle 3.0.0 or higher, your project automatically uses a default version of the build tools that the plugin specifies.

However, I am trying to configure our continuous integration server to sign the compiled application and I can't figure out which version of build tools to use.

If the build.gradle defines a buildToolsVersion then this can be extracted, but how would I find the "default" version pragmatically if none is defined?

All the documentation says to use the "default" or "recommended" version, but never defines how to find this

like image 377
MrK Avatar asked Oct 17 '25 10:10

MrK


1 Answers

One does not calculate nor define the default/recommended value for buildToolsVersion, hence it defaults to the latest build-tools, always matching the target API level, which is being defined by the targetSdkVersion. the Release Notes of the SDK Build Tools read:

SDK Build Tools release notes Android SDK Build-Tools is a component of the Android SDK required for building Android apps. It's installed in the /build-tools/ directory.

You should always keep your Build Tools component updated by downloading the latest version using the Android SDK Manager. If you're using Android plugin for Gradle 3.0.0 or higher, your project automatically uses a default version of the build tools that the plugin specifies.

And most interestingly:

To use a different version of the build tools, specify it using buildToolsVersion in your module's build.gradle, as follows ...

This means, that one can simply remove the buildToolsVersion property from a module's build.gradle. before one always had to change two values when updating the target API - and even more often when updating the build-tools . There are also new requirements for the Play Store.

like image 188
Martin Zeitler Avatar answered Oct 18 '25 22:10

Martin Zeitler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!