Calculating default buildToolsVersion - android

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

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.

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.

Related

Where I can find actual android build tool version that used if it uspecified

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.
https://developer.android.com/studio/releases/build-tools
How can I check what build tools version is actual used if I have no buildToolsVersion in my build.gradle and no ~/.gradle/gradle.properties
Go to Project Structure then select Module.

With Android gradle plugin 3.1.0 is it still best to manually specify the android build tools?

In release 3.1.0 of the Android gradle plugin release notes (https://developer.android.com/studio/releases/gradle-plugin) Google writes that the plugin requires:
Build Tools 27.0.3 or higher. Keep in mind, you no longer need to
specify a version for the build tools using the
android.buildToolsVersion property—the plugin uses the minimum
required version by default.
It says it will auto-select the "minimum". So what happens if a fix or improvement is released to the android tools? For example the minimum is 27.0.3 but 28.0.2 has been released with a new version of D8 that may have fixes or improvements but the plugin will continue using 27.0.3 if not otherwise specified so it still seems best to manually select the build tools as needed so you aren't stuck on the minimum version required?
It's the minimum required version, you can keep it as it is now but it's highly recommended to update to the newest version.

The specified Android SDK Build Tools version (19.0.0) is ignored

Warning:The specified Android SDK Build Tools version (19.0.0) is
ignored, as it is below the minimum supported version (26.0.2) for
Android Gradle Plugin 3.0.1. Android SDK Build Tools 26.0.2 will be
used. To suppress this warning, remove "buildToolsVersion '19.0.0'"
from your build.gradle file, as each version of the Android Gradle
Plugin now has a default version of the build tools.
What if I want to develop an apk that can work for API 19?
Is there a way without getting errors to compile and test the application easily?
buildToolsVersion is not your App's minimum API support version. You'll want to use minSdkVersion 19 to support API 19. Generally you'll always want to use the latest build tool version. If you want to test API 19 functionality, download and use the Android 4.4 emulator.

How to set the minimum SDK Build Tools version required in an Android Studio project?

When I try to run my React Native project in the Android emulator I get the following error:
The SDK Build Tools revision (23.0.1) is too low for project ':app'.
Minimum required is 25.0.0
My android/app/build.gradle file specifies:
buildToolsVersion "23.0.1"
On Android Studio, it also logs the same error for each of the packages I'm using:
I believe this started happening after I inadvertently updated some stuff that Android Studio suggested.
All the build.gradle files that I've checked specify version 23.0.1, but for some reason 25.0.0 seems to be overriding that setting.
How do I go about correcting this?
Ran into this issue and realized that the error is quite vague. Coming from an iOS background into React Native, I've had to learn a lot more about the Android ecosystem. The problem is that your project Gradle version is too high.
In your project's (top level) build.gradle you may be using:
classpath 'com.android.tools.build:gradle:2.3.1'
Gradle v2.3.1, implicitly sets the minimum SDK Build Tools revision to 25.0.0.
To fix, you can simply revert back to:
classpath 'com.android.tools.build:gradle:2.2.3'
This will allow your project's modules to use buildToolsVersions 23.0.1 or 25.0.2
Install required Build Tools version 25.0.0
Update buildToolsVersion in build.gradle file and sync project
Set compileSdkVersion 25 and targetSdkVersion 25
Clean and Build your project again
Finally, Run on device
Hope this will help~
May be you are updated your studio version and open your old project if you do that then you want to go to package explorer app and right click on it and open modual setting one window open then select the project and set the Gradle version
and android plugin version
example
My studio version is 2.3
then Gradle version = 3.3
and Android plugin version = 2.3.0
if you not find then create new project blank project and see the setting and apply on your project
Android SDK Build Tools are required to build Android apps (see https://developer.android.com/studio/command-line/index.html#tools-build). It's recommended to always use the latest version.
In your case react* libraries aren't compatible with current build tools version (23.0.1) so you need to upgrade (25.0.2 is the latest version at the moment).
The version is specified in build.gradle of your module. After syncing project everything would be fine or an error will be displayed that will suggest installing the missing version. Android Studio will do that for you.
android {
...
buildToolsVersion "25.0.2"
Uninstall all new-ones 'Android SDK Build-Tools' versions after comes 23.0.1 in SDK Manager and Sync and try again for that project only...

Gradle sync asking for nonexistent build tool version

Failed to sync Gradle project
Error: failed to find Build Tools revision 24.1.2
However, Build Tools revision 24.1.2 does not exist. Before this error came up, Gradle was giving an error that it required android-19, even though the build.gradle file clearly specifies android-21. This was fixed by installing android-19.
However, because revision 24.1.2 does not exist for Build Tools, it cannot be worked around by simply installing this version. The build.gradle file specifies version 22.0.1, but it seems to be completely ignored. I also tried changing it from the app properties window but it still failed to compile.
What may be causing this is the fact that some of the code was developed on another computer, and slight differences are causing gradle to require incorrect version numbers.
How can this problem be fixed?
You should just open Android SDK Manager. It is the app where you install Android SDK and other helper apps.
When it is refreshed you should see there is Build Tools version 24.1.2 at the top. You should install that.
I've just checked and 24.1.2 is installed on my machine.
In android studio go to
Tool => Android => SDK Manager and update your build tools.
Check if it is installed ?
You may have a gradle configuration problem. Can you post your gradle config?
At the time of writing, the latest Android SDK Build Tools version is 22.0.1 and the latest Android SDK Tools version is 24.1.2.
This would be an example of a gradle config targeting the latest versions (no need to specify the SDK tools version):
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
...
Latest release notes can be found here:
Android SDK Build Tools:
https://developer.android.com/tools/revisions/build-tools.html
Android SDK Tools:
https://developer.android.com/tools/sdk/tools-notes.html
I hope this helps!

Categories

Resources