添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

"was it always this way" -- no. "this is a new change?" -- yes. "how the version is chosen if I didn't specify one" -- the Android Plugin for Gradle has a default value that it will use. CommonsWare Oct 30, 2017 at 14:42 so now I don't have to worry about buildToolsVersion . please add your comment as an answer and I will accept it. humazed Oct 30, 2017 at 14:44

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.

For the purposes of building older release of my software and possibly hotfixing it, is it recommended to instead explicitly specify the build tools version? Is it possible that an older version of my software will not build with the latest build tools version? void.pointer Jul 2, 2018 at 14:42 I'm not sure it defaults to latest. According to current doc (Nov 2020), it will not pick the latest build tools version, but the default one that's specified by the your version of the Android plugin. So by specifying the version of the plugin, you also somewhat control the build tools version (just reasoning). Quote: "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." Stan Nov 18, 2020 at 16:08