To develop with Android 12 APIs and test your app with the Android 12 behavior
changes, you need to set up the Android 12 SDK. Follow the instructions on this
page to set up the Android 12 SDK in Android Studio and build and run your app
on Android 12.
Get Android Studio
The Android 12 SDK includes changes that are not compatible with some lower
versions of Android Studio. For the best development experience with the Android
12 SDK, use Android Studio Arctic Fox | 2020.3.1 or higher.
Get Android Studio
Install the SDK
Within Android Studio, you can install the Android 12 SDK as follows:
- Click
Tools > SDK Manager
.
- In the
SDK Platforms
tab, expand the
Android 12.0 ("S")
section and
select the
Android SDK Platform 31
package.
- In the
SDK Tools
tab, expand the
Android SDK Build-Tools 34
section
and select the latest
31.x.x
version.
- Click
Apply > OK
to download and install the selected packages.
Update your app's build configuration
To access Android 12 APIs and test your app's compatibility with Android 12,
open your module-level
build.gradle
or
build.gradle.kts
file, and update the
compileSdkVersion
and
targetSdkVersion
with values for Android 12:
Groovy
android {
compileSdkVersion 31
defaultConfig {
targetSdkVersion 31
}
}
Kotlin
android {
compileSdkVersion(31)
defaultConfig {
targetSdkVersion(31)
}
}
To learn about which changes might affect you, and to learn how to test these
changes in your app, read the following topics:
To learn more about new APIs and features available in Android 12, read
Android
12 features
.