更新 IDE 和 SDK 工具
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
安装 Android Studio 后,您可以通过自动更新和 Android SDK 管理器让 Android Studio IDE 和 Android SDK 工具保持最新状态。
如果您使用 JetBrains Toolbox 安装了 Android Studio,则 Toolbox 负责处理 Android Studio 更新。借助 Toolbox,您可以并行安装 Canary 版、RC 版和稳定版 Android Studio。此外,您还可以根据需要回滚到各个版本的更早版本。可用更新会显示在 Toolbox 中,如图 1 所示。
图 1. 显示可用更新的 JetBrains Toolbox 界面。
更新 IDE 和变更渠道
如果您手动安装了 Android Studio,有适用于 IDE 的可用更新时,Android Studio 会通过一个小气泡对话框通知您。如需手动检查更新,请依次点击 File > Settings > Appearance & Behavior > System Settings > Updates(在 macOS 上,请依次点击 Android Studio > Check for Updates)。参见图 2。
您可以通过以下发布渠道获取 Android Studio 更新:
如果您想要试用某个预览版(Canary 版或 RC 版),并同时为生产项目使用稳定 build,则可以同时安装两个版本。
图 2. Android Studio 的更新偏好设置。
删除未使用的 Android Studio 目录
当您首次运行 Android Studio 的主要版本时,它会查找包含缓存、设置、索引和日志的目录,以确定是否存在找不到对应安装内容的 Android Studio 的版本。然后,Delete Unused Android Studio Directories 对话框中会显示这些未使用的目录的位置、大小和最后修改时间,并提供删除它们的选项。
使用 SDK 管理器更新工具
Android SDK 管理器可以帮助您下载 SDK 工具、平台和开发应用所需的其他组件。下载后,您可以在标示为 Android SDK Location 的目录中找到各软件包,如图 3 所示。
如需从 Android Studio 打开 SDK 管理器,请依次点击 Tools > SDK Manager 或点击工具栏中的 SDK Manager 图标
。如果您没有使用 Android Studio,则可使用 sdkmanager
命令行工具来下载工具。
已安装的软件包如有更新,其旁边的复选框中会显示短划线图标
。
- 如需更新某个软件包或安装新软件包,请选中相应复选框。
- 如需卸载某个软件包,请点击以清除对应的复选框。
待下载的更新在左侧列中以下载图标
表示。待执行的移除项以红色 X 标记
表示。
如需更新所选的软件包,请点击 Apply 或 OK,然后同意所有许可协议。
图 3. Android SDK 管理器。
必需的软件包
您可以在 SDK Tools 标签页中找到以下工具:
- Android SDK Build-Tools
- 包含构建 Android 应用的工具。如需了解详情,请参阅 SDK Build Tools 版本说明。
- Android SDK Platform-Tools
- 包含 Android 平台所需的各种工具,包括
adb
工具。
- Android SDK Command-Line Tools
- 包括 ProGuard 等基本工具。如需了解详情,请参阅 SDK 工具版本说明。
- Android SDK Platform
在 SDK Platforms 标签页中,您必须安装至少一个版本的 Android 平台,才能编译应用。请使用最新版本的平台作为构建目标,以便在最新设备上提供最佳用户体验。如需下载某个版本,请选中版本名称旁边的复选框。
您仍然可以在较低版本上运行您的应用;不过,若要在搭载最新版 Android 的设备上使用应用的新功能,您必须以最新版为构建目标。
- Google USB Driver
- 对于 Windows 是必需的。包含可帮助您使用 Google 设备执行
adb
调试的工具。如需安装,请访问获取 Google USB 驱动程序。
推荐的软件包
建议您使用以下工具进行开发:
- Android 模拟器
- 基于 QEMU 的设备模拟工具,可用于在实际的 Android 运行时环境中调试和测试应用。如需了解详情,请参阅模拟器版本说明。
注意:以前由支持仓库软件包提供的大多数 API 库(例如 Android 支持库、约束布局、Google Play 服务和 Firebase)现在可以从 Google 的 Maven 制品库中获得。采用 Android Studio 3.0 及更高版本创建的项目将在 build 配置中自动包含此仓库。如果您使用的是之前的项目,则必须手动向您的 build.gradle
或 build.gradle.kts
文件中添加 Google 的 Maven 制品库。
- Intel 或 ARM 系统映像
- 运行 Android 模拟器需要该系统映像。平台的每个版本均包含所支持的系统映像。您也可以之后在 AVD 管理器中创建 Android 虚拟设备 (AVD) 时下载系统映像。根据开发计算机的处理器选择 Intel 或 ARM。
- Google Play 服务
- 包含一组库、Javadoc 和示例,可帮助您构建应用。如果您想使用 Google Play 服务中的 API,则必须使用 Google API 系统映像或 Google Play 系统映像。
以上列表并不详尽,您可以添加其他网站,以便从第三方网站下载更多软件包,如以下部分所述。
在某些情况下,某个 SDK 软件包可能需要另一个工具的特定最低修订版。如果存在这种情况,SDK 管理器将发出警告通知您,并将依赖项添加到您的下载列表。
修改或添加 SDK 工具网站
在 SDK Update Sites 标签页下,您可以添加和管理托管自有工具的其他网站,然后从这些网站下载软件包。Android Studio 会检查您添加的 SDK 网站中是否有 Android 工具和第三方工具更新。
例如,某个移动运营商或设备制造商可能会为其基于 Android 系统的自有设备提供额外的 API 库。如需使用他们的库进行开发,您可以在 SDK Update Sites 标签页中将其 SDK 工具网址添加到 SDK 管理器中,以安装相应 Android SDK 软件包。
如果运营商或设备制造商在其网站上提供了 SDK 插件仓库文件,请按照以下步骤将其网站添加到 Android SDK 管理器中:
- 点击 SDK Update Sites 标签页。
- 在窗口顶部点击 Add
。
- 输入第三方网站的名称和网址,然后点击 OK。
- 确保已选中 Enabled 列中相应的复选框。
- 点击 Apply 或 OK。
该网站提供的所有 SDK 软件包都将视情况显示在 SDK Platforms 或 SDK Tools 标签页中。
借助 Gradle 自动下载缺失的软件包
当您从命令行或 Android Studio 运行 build 时,只要已在 SDK 管理器中接受相应的 SDK 许可协议,Gradle 就会自动下载项目依赖的缺失 SDK 软件包。
在您使用 SDK 管理器接受许可协议后,Android Studio 会在 SDK 主目录内部创建一个 licenses 目录。此 licenses 目录是 Gradle 自动下载缺失软件包所必需的。
如果您已经在一个工作站上接受许可协议,但希望在另一个工作站上构建项目,则可以通过复制已接受的许可所在的目录来导出许可。
如需将许可复制到另一台机器上,请按以下步骤操作:
- 在已经安装 Android Studio 的机器上,依次点击 Tools > SDK Manager。注意窗口顶部的 Android SDK Location。
前往该目录,并在其中找到 licenses/
目录。
如果您没有看到 licenses/
目录,请返回到 Android Studio,更新您的 SDK 工具并接受许可协议。返回到 Android SDK 主目录后,您现在应该会看到该目录。
- 复制整个
licenses/
目录,并将其粘贴到您希望用于构建项目的计算机上的 Android SDK 主目录中。
Gradle 现在会自动下载项目依赖的缺失软件包。
请注意,对于从 Android Studio 运行的 build,此功能自动处于停用状态,因为 SDK 管理器会处理 IDE 缺失软件包的下载任务。如需手动停用此功能,请在项目的 gradle.properties
文件中设置 android.builder.sdkDownload=false
。
使用命令行更新工具
在没有图形界面的系统(例如 CI 服务器)上,您无法在 Android Studio 中使用 SDK 管理器。请改为使用 sdkmanager
命令行工具来安装和更新 SDK 工具和平台。
使用 sdkmanager
安装 SDK 工具和平台后,您可能需要接受尚未接受的任何许可。您也可以使用 sdkmanager
完成此操作:
$ sdkmanager --licenses
此命令会扫描所有已安装的 SDK 工具和平台,并显示尚未接受的任何许可。系统会提示您接受每个许可。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-17。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-17。"],[],[],null,["# Update the IDE and SDK tools\n\nOnce you install Android Studio, you can keep the Android Studio IDE\nand Android SDK tools up to date with automatic updates\nand the Android SDK Manager.\n\nUpdate your IDE using JetBrains Toolbox\n---------------------------------------\n\nIf you installed Android Studio using\n[JetBrains Toolbox](https://www.jetbrains.com/toolbox-app/), then\nToolbox is responsible for handling updates to Android Studio. Toolbox lets you install canary,\nRC, and stable versions of Android Studio in parallel. It also lets you roll back to earlier\nversions of each, if required. When an update is available it displays in Toolbox, as\nshown in figure 1.\n\n**Figure 1.** Jetbrains Toolbox showing available updates.\n\nUpdate your IDE and change channels\n-----------------------------------\n\nIf you installed Android Studio manually, Android Studio notifies you with a small bubble\ndialog when an update is available for the IDE. To manually check for updates,\nclick **File** \\\u003e**Settings** \\\u003e**Appearance \\& Behavior** \\\u003e\n**System Settings** \\\u003e **Updates**\n(on macOS, **Android Studio** \\\u003e **Check for Updates**). See figure 2.\n\nUpdates for Android Studio are available from the following\nrelease channels:\n\n- **Canary channel:** these bleeding-edge releases are updated roughly weekly and are available for download on the [Preview release](/studio/preview) page.\n\n In addition to receiving canary versions of Android Studio, you also receive preview\n versions of other SDK tools, including the Android Emulator.\n\n Although these builds are subject to more\n bugs, they do get tested and are available so you can try new\n features and provide feedback.\n\n\n **Note:** This channel is not recommended for\n production development.\n- **RC channel:** these are release candidates based on stable canary builds and are available for download on the [Preview release](/studio/preview) page. They are released to get feedback before being integrated into the stable channel.\n- **Stable channel:** the official, stable release of [Android Studio](/studio).\n\nIf you'd like to try one of the preview channels (canary or RC)\nwhile still using the stable build for your production projects, you\ncan [install them side by side](/studio/preview/install-preview).\n\n**Figure 2.** The Android Studio Updates\npreferences.\n\n### Delete unused Android Studio directories\n\nWhen you run a major version of Android Studio for the first time, it looks for directories\ncontaining caches, settings, indices, and logs for versions of Android Studio for which a\ncorresponding installation can't be found. The **Delete Unused Android Studio\nDirectories** dialog then displays locations, sizes, and last-modified times of these unused\ndirectories and provides an option to delete them.\n\nUpdate your tools with the SDK Manager\n--------------------------------------\n\nThe Android SDK Manager helps you download the SDK tools, platforms, and\nother components you need to develop your apps. Once downloaded, you can find\neach package in the directory indicated as the **Android SDK Location**,\nas shown in figure 3.\n\nTo open the SDK Manager from Android Studio, click **Tools \\\u003e\nSDK Manager** or click **SDK Manager**\n\nin the toolbar. If you're not using Android Studio, you can download tools\nusing the [`sdkmanager`](/studio/command-line/sdkmanager) command-line tool.\n\nWhen an update is available for a package you already have, a dash\nappears in the checkbox next to the package.\n\n- To update an item or install a new one, select the checkbox.\n- To uninstall a package, click to clear the checkbox.\n\nPending updates are indicated in the left column with a download icon\n. Pending removals are\nindicated with a red X: .\n\nTo update the selected packages,\nclick **Apply** or **OK** and agree to any\nlicense agreements.\n| **Note:** To install SDK packages from another release channel without changing your IDE's release channel, see the [`sdkmanager` documentation](/tools/sdkmanager#usage).\n\n**Figure 3.** The Android SDK Manager.\n\n### Required packages\n\nYou can find the following tools in the **SDK Tools** tab:\n\n**Android SDK Build Tools**\n: Includes tools to build Android apps.\n For more information, see the\n [SDK Build Tools release notes](/studio/releases/build-tools).\n\n**Android SDK Platform Tools**\n: Includes various tools required by the\n Android platform, including the [`adb`](/studio/command-line/adb) tool.\n\n**Android SDK Command-Line Tools**\n: Includes essential tools such as ProGuard. For more information, see\n the [SDK Tools release notes](/studio/releases/sdk-tools).\n\n**Android SDK Platform**\n\n: In the **SDK Platforms** tab, you must install at least one version of the Android\n platform so you can compile your app. Use the latest platform version as your build target to\n provide the best user experience on the latest devices. To download a version, select the checkbox next\n to the version name.\n\n You can still run your app on older versions; however, you must build against the latest\n version to use new features when running on devices with the latest version of\n Android.\n\n**Google USB Driver**\n: Required for Windows. Includes tools to help you perform\n [`adb`](/studio/command-line/adb) debugging with Google devices. To install, visit\n [Get the Google USB Driver](/studio/run/win-usb)."]]