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 older versions of Android Studio. For the best development experience with the Android 12 SDK, use Android Studio Arctic Fox | 2020.3.1 or higher.
Install the SDK
Within Android Studio, you can install the Android 12 SDK as follows:
- Click Tools > SDK Manager.
- In the SDK Platforms tab, select Android 12.
- In the SDK Tools tab, select Android SDK Build-Tools 31.
- Click OK to install the SDK.
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.