Set Up the Android P SDK

Android P is the next major release of the Android, with a variety of great new ways you can extend your app. Android P also includes behavior changes to help improve battery life, security, and privacy, and these will affect your app on devices running the new version of Android.

To developer with Android P APIs and test your app with the Android P behavior changes, follow the instructions on this page to set up the Android P Preview SDK in Android Studio and build and run your app on Android P.

Get Android Studio 3.1 or higher

The Android P Preview SDK includes changes that are not compatible with Android Studio 3.0.

You can compile and test Android P apps using Android Studio 3.1, but some users of the Android P Preview SDK may encounter Gradle sync failures and additions of out-dated dependencies with Android Studio 3.1.

For the best development experience with the Android P Preview SDK, we recommend that you install the latest Android Studio 3.2 canary.

GET ANDROID STUDIO 3.2 CANARY

You can keep your existing version of Android Studio installed because you can install multiple versions side by side.

Get the Android P Preview SDK

After you install and open Android Studio 3.2, install the Android P Preview SDK as follows:

  1. Click Tools > SDK Manager.
  2. In the SDK Platforms tab, select Android P Preview.
  3. In the SDK Tools tab, select Android SDK Build-Tools 28-rc2 (or higher).
  4. Click OK to begin install.

Update your build configuration

To fully test your app’s compatibility with Android P and begin using new APIs, open your module-level build.gradle file and update the compileSdkVersion and targetSdkVersion as shown here:

android {
    compileSdkVersion 28

    defaultConfig {
        targetSdkVersion 28
    }
    ...
}

Note: Starting with version 3.0.0 of the Android Plugin for Gradle, you don’t need to declare buildToolsVersion anymore. To learn about the changes in Android P that might affect your app and begin testing them, read Android P Behavior Changes.

To learn more about new APIs available in Android P, read Android P Features and APIs.

Tagged:

Leave a Reply