Home » Android » android – Is buildToolsVersion optional?

android – Is buildToolsVersion optional?

Posted by: admin June 15, 2020 Leave a comment

Questions:

After updating to Android studio 3.0 and creating a new project I noticed that buildToolsVersion is missing and the project works fine.

so it’s clearly optional now. my question is:
was it always this way or this is a new change?

how the version is chosen if I didn’t specify one.
my first thought that it’s automatically set to the newest version installed in SDK manager, but I found it set to build_tools_version: \"26.1.0\" in android-studio\build\android-profile\profile-2017-10-30-16-28-12-121.json
in spite of having build_tools version: 27.0.0 installed in my SDK manager.
it only changed to 27.0.0 after I manually added buildToolsVersion '27.0.0' to build.gradle

what is the best practice regarding adding buildToolsVersion to build.gradle since it’s now in the default template in AS 3.0 and 3.1?

How to&Answers:

If you check the SDK Build Tools Release Notes, it says:

By default, the Android SDK uses the most recent downloaded version of the Build Tools. If your projects depend on older versions of the Build Tools, the SDK Manager allows you to download and maintain separate versions of the tools for use with those projects

So yes, it is optional and defaults to latest.