What are the Android SDK build-tools, platform-tools and tools? And which version should be used?
Asked Answered
A

6

350

I know this is a very rudimentary question, but to my surprise, I could not find any document about Android SDK Build-tools. Besides Android SDK Tools and Android SDK Platform-tools, there are a bunch of Android SDK Build-tools as shown in the appended screenshot. Could anyone point to a source explaining all of them and help clarifying how a certain version of Android SDK Build-tools is picked for use?

enter image description here

Edited (2014-02-27):

I still do not fully understand all the tools. The following is my limited understanding based on Google's latest documents:

  • Android SDK Build-tools used to be components of Android SDK Platform-tools. They have been decoupled from Android SDK Platform-tools, so that the build tools can be updated independently of the integrated development environment (IDE) components.
  • Android SDK Platform-tools are customized to support the features of the latest Android platform. They are backward compatible so that you always use the latest update of Android SDK Platform-tools even your app targets older Android platforms.
  • SDK tools are platform independent and are required no matter which Android platform you are developing on.

I still do not understand the rationale of taking Android SDK Build-tools out of Android SDK Platform-tools which has a single instance and is easy to manage the update. The only possible reason that I can think of is that some apps have to rely on older build components to build them. Google's document mentions this, but does not explain why. Looking at the release notes, you will notice that updates of Android SDK Build-tools are primarily for fixing bugs or/add support for new platforms. The only reason that I can think of for some apps to use older versions of Android SDK Build-tools is that they rely on certain bugs of Android SDK Build-tools. These apps would not function normally without being built with these bugs. I wish Google could explain this better by giving one or two examples showing why these bugs in the tools are critical for certain apps.

Acromegaly answered 11/11, 2013 at 16:57 Comment(0)
C
91

About the version of Android SDK Build-tools, the answer is

By default, the Android SDK uses the most recent downloaded version of the Build Tools.

Source

In Eclipse, you can choose a specific version by using the sdk.buildtools property in the project.properties file.

There seems to be no official page explaining all the build tools. Here is what the Android team says about this.

The [build] tools, such as aidl, aapt, dexdump, and dx, are typically called by the Android build tools or Android Development Tools (ADT), so you rarely need to invoke these tools directly. As a general rule, you should rely on the build tools or the ADT plugin to call them as needed.

Source

Anyway, here is a synthesis of the differences between tools, platform-tools and build-tools:

  • Android SDK Tools
    • Location: $ANDROID_HOME/tools
    • Main tools: ant scripts (to build your APKs) and ddms (for debugging)
  • Android SDK Platform-tools
    • Location: $ANDROID_HOME/platform-tools
    • Main tool: adb (to manage the state of an emulator or an Android device)
  • Android SDK Build-tools
    • Location: $ANDROID_HOME/build-tools/$VERSION/
    • Documentation
    • Main tools: aapt (to generate R.java and unaligned, unsigned APKs), dx (to convert Java bytecode to Dalvik bytecode), and zipalign (to optimize your APKs)
Chauvin answered 17/1, 2014 at 19:3 Comment(4)
I am really glad that there is change log for different build tools versionsRecover
@Chauvin I used the old build tool(version 17) for my project. Can I rebuild it with the latest build tool?Palikar
Can we use same sdk + build tools for eclipse and studio?Sycophant
How do we install the build tools through Command LineRuano
R
38

Android SDK build tools are used to debug, build, run and test an Android application.

Android Build Tools can be used to develop and work from command line or IDE (i.e Eclipse or Android Studio).

Also used to connect Android devices and root them.(fastboot, adb and more..)

Always use the latest.(Recommended)

More Info on Android Build tools and commands

Riane answered 19/11, 2013 at 8:51 Comment(8)
Thanks for the info. Do you mean that Android Build Tools is "used to connect Android devices and root them"? adbis a part of Android Platform Tools. Does adb depend on Android Build Tools to function? If so, how? I am curious.Acromegaly
adb can be used to push and pull files from command line. (More functionalities.) fastboot can be used to flash custom boot loaders. However these commands are not useful for Android development unless you use terminal for development. Everything is available in the IDE itself.Riane
My understanding is Eclipse uses adb.exe in the background.Acromegaly
@Riane so what's the difference between android sdk: tools, platform-tools and build-tools? I can build and run my app without a build-tools.Sholokhov
@kreker Check my answer. You cannot build an app without the aapt command for instance, which is part of the build-tools package.Chauvin
@Riane -- "Always use the latest" -- why? (If sticking with a set Android version, and the build tools work at that point)Sewer
@Sewer Yes. Sticking with the set tools for a version will work. Build tools are updated as an when the new version of Android comes in. You would want to compile and test the application for the latest Android versions.Riane
@Riane This depends on the purpose of the application. If this is an app for the 'App Store' for mass consumer purposes, this might make sense, but if targeting a specific piece of hardware for a custom device, it makes sense to target a specific version and stick to it for reasons of stability.Sewer
C
20

I'll leave the discussion of the difference between Build Tools, Platform Tools, and Tools to others. From a practical standpoint, you only need to know the answer to your second question:

Which version should be used?

Answer: Use the most recent version.

For those using Android Studio with Gradle, the buildToolsVersion has to be set in the build.gradle (Module: app) file.

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    ...
}

Where do I get the most recent version number of Build Tools?

Open the Android SDK Manager.

  • In Android Studio go to Tools > Android > SDK Manager > Appearance & Behavior > System Settings > Android SDK
  • Choose the SDK Tools tab.
  • Select Android SDK Build Tools from the list
  • Check Show Package Details.

The last item will show the most recent version.

enter image description here

Make sure it is installed and then write that number as the buildToolsVersion in build.gradle (Module: app).

Cantatrice answered 31/8, 2016 at 1:36 Comment(2)
If there is 24.0.2, why are 24.0.1 and 24 not marked as obsolete (the standalone manager allows to show/hide obsolete packages)?Detest
@user1803551, it is not always desirable to automatically use the most recent build tools version. For example, say you have already thoroughly tested your app with a particular build tools version. If you update your build tools, it is possible that a change there could break something in your app. Allowing developers to keep using old build tools versions allows them to be sure that their build will keep working as expected. If you look at the pattern of what is declared obsolete, you can see that 24 and 24.0.1 will eventually be declared obsolete.Cantatrice
Q
17

You can find details about these in this Android - Command Line Tools


tl;dr:

SDK Tools:

  1. Android SDK Manager (sdkmanager)
  2. AVD Manager (avdmanager)
  3. Dalvik Debug Monitor Server (ddms)

Build Tools:

  1. signer
  2. proGuard
  3. zipalign
  4. jobb

Platform Tools:

  1. adb
  2. aidl, aapt, dexdump, and dx
  3. bmgr
  4. logcat
Quicksilver answered 4/3, 2017 at 7:41 Comment(1)
aidl, aapt, dexdump, and dx these are components of build tools not platform toolsCocke
S
10

The right answer is

Decoupled the build-specific components of the Android SDK from the platform-tools component, so that the build tools can be updated independently of the integrated development environment (IDE) components.

link (expand Revision 17)

Sholokhov answered 11/1, 2014 at 0:8 Comment(4)
Thank you for the information. If newer versions are just improved older versions, why doesn't Google just have one Build-tools and keep updating it like SDK Tools and Platform-tools? In other words, what is the reason to have older versions there?Acromegaly
I just tried to upvote this answer but it turns out I already upvoted it last year! @Hong, they keep the old build tools because as they update the tools, some features become deprecated. But app developers might have source code that relies on those features so they keep the old versions available to support those old code bases.Aisne
In this case, should they have a list of deprecated features so that developers can know exactly whether they still have to use old versions?Acromegaly
@Hong: That's exactly the question I was looking for. Now... off to find an answer :)Voodooism
C
2

Android SDK Build Tools are exactly what the name says they are; tools for building Android Applications.It is very important to use the latest build tools version (selected automatically by your IDE via the Android SDK) but the reason the old versions are left there is to support backward compatibility, that is If your projects depend on older versions of the Build Tools.

Consumable answered 21/5, 2015 at 7:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.