The Android 16 Beta is now available.
Try it out today and let us know what you think!
设置 Android 12L SDK
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如需使用 Android 12L API 进行开发并测试您的应用,您需要设置 Android 12L SDK。请按照此页面中的说明在 Android Studio 中设置 Android 12 SDK,并在 Android 12L 上构建和运行您的应用。
获取 Android Studio
Android 12L SDK 包含与某些较低版本的 Android Studio 不兼容的变更。为了获得 Android 12L SDK 的最佳开发体验,请使用 Android Studio Chipmunk | 2021.2.1 或更高版本。
获取 Android Studio
安装 SDK
在 Android Studio 中,您可以按如下方式安装 Android 12L SDK:
- 依次点击 Tools > SDK Manager,然后点击 Show Package Details。
- 在 SDK Platforms 标签页中,展开 Android 12L ("Sv2") 部分,然后选择 Android SDK Platform 32 软件包。
- 在 SDK Tools 标签页中,展开 Android SDK Build-Tools 34 部分,然后选择最新的
32.x.x
版本。
- 依次点击应用 > 确定,下载并安装所选软件包。
更新应用的 build 配置
如需访问 12L API 并测试应用与 12L 的兼容性,请打开模块级 build.gradle
或 build.gradle.kts
文件,并使用 12L 的值更新 compileSdkVersion
和 targetSdkVersion
:
Groovy
android {
compileSdkVersion "32"
defaultConfig {
targetSdkVersion "32"
}
}
Kotlin
android {
compileSdkVersion("32")
defaultConfig {
targetSdkVersion("32")
}
}
如需详细了解 12L 中的功能和变更,请参阅 12L 功能和变更。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Set up the 12L SDK\n\nTo develop with the 12L APIs and test your app, you need to set up the 12L SDK.\nFollow the instructions on this page to set up the Android 12 SDK in Android\nStudio and build and run your app on 12L.\n\nGet Android Studio\n------------------\n\nThe 12L SDK includes changes that are not compatible with some lower versions of\nAndroid Studio. For the best development experience with the 12L SDK, use\nAndroid Studio Chipmunk \\| 2021.2.1 or higher.\n\n[Get Android Studio](/studio)\n\nInstall the SDK\n---------------\n\nWithin Android Studio, you can install the 12L SDK as follows:\n\n1. Click **Tools \\\u003e SDK Manager** , then click **Show Package Details**.\n2. In the **SDK Platforms** tab, expand the **Android 12L (\"Sv2\")** section and select the **Android SDK Platform 32** package.\n3. In the **SDK Tools** tab, expand the **Android SDK Build-Tools 34** section and select the latest `32.x.x` version.\n4. Click **Apply \\\u003e OK** to download and install the selected packages.\n\nUpdate your app's build configuration\n-------------------------------------\n\nTo access 12L APIs and test your app's compatibility with 12L, open your\nmodule-level `build.gradle` or `build.gradle.kts` file, and update the\n`compileSdkVersion` and `targetSdkVersion` with values for 12L: \n\n### Groovy\n\n```groovy\nandroid {\n compileSdkVersion \"32\"\n\n defaultConfig {\n targetSdkVersion \"32\"\n }\n}\n```\n\n### Kotlin\n\n```kotlin\nandroid {\n compileSdkVersion(\"32\")\n\n defaultConfig {\n targetSdkVersion(\"32\")\n }\n}\n```\n\nTo learn more about the features and changes in 12L, see [12L features and\nchanges](/about/versions/12/12L/summary)."]]