Alexander
Alexander

Reputation: 48262

Why buildToolsVersion belongs to build.gradle?

Why buildToolsVersion belongs to build.gradle as if it's some property of a project and not the property of the build system? There seems to be little use of having an obsolete build tools version in the build.gradle file and the only sensible thing one can do with it is to make sure it's up-to-date with the latest build tools release. Because of that I fail to see any advantages of having specified it in the build.gradle. Is it more a necessary technical limitation of the build system?

Upvotes: 1

Views: 74

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363825

It is quite difficult to try to answer this kind of question.

Anyway the buildToolsVersion attribute specifies the version of the compilers for example the aapt, the dx, the renderscript compiler, the version of the SDK build tools, that you want to use to build your project.

It is related to the building process but it is also related to the specified project that you are working.

The Android team releases a new version (the x.0.0) for each API level and often updates the compilers with minor updates (the x.0.1 , x.0.2 and so on).
It is a good option to keep the Build Tools component updated but putting this value in build.gradle you can choose when to move to the new version avoiding the possibility that Google updates it silently.
Also in this way the final artifact (apk or aar) is repeatable in the future and doesn't depend by the IDE or SDK Tools used to compile (in same case the apk signature schema changed and there ware some significat changes in the renderscript support in the past).

Upvotes: 1

Related Questions