Reputation: 662
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
Upvotes: 4
Views: 1712
Reputation: 12197
If you do not specify the buildToolsVersion
, the Android Gradle Plugin will use its default build tools. For each AGP release, the default build tools version is documented.
At the moment of writing, the latest AGP version is 7.3.0, and it will use build tools 30.0.3 by default. (The latest build tools is 33.0.1.)
This is also clarified in the build tools release notes page:
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.
Upvotes: 2
Reputation: 76569
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.
Upvotes: 5