什麼是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 (模塊:應用程序)。

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