什么是Android SDK构建工具,平台工具和工具?应该使用哪个版本?

本文翻译自:What are the Android SDK build-tools, platform-tools and tools? And which version should be used?

I know this is a very rudimentary question, but to my surprise, I could not find any document about Android SDK Build-tools. 我知道这是一个非常基本的问题,但令我惊讶的是,我找不到任何关于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. 除了Android SDK工具和Android SDK平台工具之外,还有一堆Android SDK Build-tools,如附图所示。 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? 任何人都可以指向一个解释所有这些内容的来源,并帮助澄清如何选择某个版本的Android SDK Build-tools使用?

在此输入图像描述

Edited (2014-02-27) : 编辑(2014-02-27)

I still do not fully understand all the tools. 我仍然不完全了解所有工具。 The following is my limited understanding based on Google's latest documents: 以下是基于Google最新文档的有限理解:

  • Android SDK Build-tools used to be components of Android SDK Platform-tools . Android SDK Build-tools曾经是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平台工具分离,因此可以独立于集成开发环境(IDE)组件更新构建工具。
  • Android SDK Platform-tools are customized to support the features of the latest Android platform. Android SDK平台工具经过自定义,可支持最新Android平台的功能。 They are backward compatible so that you always use the latest update of Android SDK Platform-tools even your app targets older Android platforms. 它们向后兼容,因此您始终可以使用Android SDK平台工具的最新更新,甚至您的应用程序也可以使用较旧的Android平台。
  • SDK tools are platform independent and are required no matter which Android platform you are developing on. SDK工具独立于平台,无论您正在开发哪个Android平台,都需要SDK工具

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. 我仍然不明白从Android SDK平台工具中获取Android SDK构建工具的理由,这些工具具有单个实例并且易于管理更新。 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. 查看发行说明,您会注意到Android SDK Build-tools的更新主要用于修复错误或/添加对新平台的支持。 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 . 我可以想到一些应用程序使用旧版Android SDK Build-tools的唯一原因是它们依赖于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. 我希望Google能够通过提供一两个示例来更好地解释这一点,这些示例说明了为什么这些工具中的错误对某些应用程序至关重要


#1楼

参考:https://stackoom.com/question/1LXxS/什么是Android-SDK构建工具-平台工具和工具-应该使用哪个版本


#2楼

Android SDK build tools are used to debug, build, run and test an Android application. Android SDK构建工具用于调试,构建,运行和测试Android应用程序。

Android Build Tools can be used to develop and work from command line or IDE (ie Eclipse or Android Studio). Android Build Tools可用于从命令行或IDE(即Eclipse或Android Studio)开发和工作。

Also used to connect Android devices and root them.(fastboot, adb and more..) 也用于连接Android设备并根源。(fastboot,adb等...)

Always use the latest.(Recommended) 始终使用最新的。(推荐)

More Info on Android Build tools and commands 有关Android Build工具和命令的更多信息


#3楼

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. 将Android SDK的特定于构建的组件与平台工具组件分离,以便可以独立于集成开发环境(IDE)组件更新构建工具。

link (expand Revision 17) 链接(扩展版本17)


#4楼

About the version of Android SDK Build-tools , the answer is 关于Android SDK Build-tools的版本,答案是

By default, the Android SDK uses the most recent downloaded version of the Build Tools. 默认情况下,Android SDK使用最新下载的Build Tools版本。

Source 资源

In Eclipse, you can choose a specific version by using the sdk.buildtools property in the project.properties file. 在Eclipse中,您可以使用project.properties文件中的sdk.buildtools属性来选择特定版本。

There seems to be no official page explaining all the build tools. 似乎没有官方页面解释所有构建工具。 Here is what the Android team says about this. 以下是Android团队对此的看法。

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. [build]工具,例如aidl,aapt,dexdump和dx,通常由Android构建工具或Android开发工具(ADT)调用,因此您很少需要直接调用这些工具。 As a general rule, you should rely on the build tools or the ADT plugin to call them as needed. 作为一般规则,您应该依赖构建工具或ADT插件来根据需要调用它们。

Source 资源

Anyway, here is a synthesis of the differences between tools, platform-tools and build-tools: 无论如何,这里是工具,平台工具和构建工具之间差异综合:

  • Android SDK Tools Android SDK工具
    • Location: $ANDROID_HOME/tools 位置: $ANDROID_HOME/tools
    • Main tools: ant scripts (to build your APKs) and ddms (for debugging) 主要工具:ant脚本(用于构建APK)和ddms (用于调试)
  • Android SDK Platform-tools Android SDK平台工具
    • Location: $ANDROID_HOME/platform-tools 位置: $ANDROID_HOME/platform-tools
    • Main tool: adb (to manage the state of an emulator or an Android device) 主要工具: adb (用于管理模拟器或Android设备的状态)
  • Android SDK Build-tools Android SDK Build-tools
    • Location: $ANDROID_HOME/build-tools/$VERSION/ 位置: $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) 主要工具: aapt (生成R.java和未对齐的,未签名的APK), dx (将Java字节码转换为Dalvik字节码)和zipalign (以优化您的APK)

#5楼

Android SDK Build Tools are exactly what the name says they are; Android SDK Build Tools正如它们所说的那样; 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. 用于构建Android应用程序的工具。使用最新的构建工具版本(由IDE通过Android SDK自动选择)非常重要,但旧版本留在那里的原因是为了支持向后兼容性,即如果您的项目依赖于旧版本的Build Tools。


#6楼

I'll leave the discussion of the difference between Build Tools, Platform Tools, and Tools to others. 我将讨论Build Tools,Platform Tools和Tools之间的区别。 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. 对于使用带有Gradle的Android Studio的buildToolsVersion ,必须在build.gradle (Module:app)文件中设置build.gradle

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    ...
}

Where do I get the most recent version number of Build Tools? 我从哪里可以获得最新版本的Build Tools?

Open the Android SDK Manager. 打开Android SDK Manager。

  • In Android Studio go to Tools > Android > SDK Manager > Appearance & Behavior > System Settings > Android SDK 在Android Studio中,转到工具 > Android > SDK管理器 > 外观和行为 > 系统设置 > Android SDK
  • Choose the SDK Tools tab. 选择SDK工具选项卡。
  • Select Android SDK Build Tools from the list 从列表中选择Android SDK Build Tools
  • Check Show Package Details . 选中显示包详细信息

The last item will show the most recent version. 最后一项将显示最新版本。

在此输入图像描述

Make sure it is installed and then write that number as the buildToolsVersion in build.gradle (Module: app). 请确保它已安装,然后写一个数字作为buildToolsVersionbuild.gradle (模块:应用程序)。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章