Migrating apps to Android 11

With each release of Android we introduce new features as well as behavior changes aimed at making the Android more helpful, more secure, and better performing. In many cases your app will work exactly as expected out of the box, while in other cases you might need make changes to your app to adapt to the changes.

Since users can start receiving the new platform as soon as the source code is released to AOSP (Android Open Source Platform), it's important for apps to be ready, performing as expected for users and ideally taking advantage of new features and APIs to get the most out of the new platform.

This article offers a high-level view of typical development and testing phases that can help you make a plan for readiness that's well-aligned with the platform release timeline and ensures a great experience for your users on Android 11.

A typical migration has two phases, which can be concurrent:

  • Ensuring app compatibility (by Android 11 final release)
  • Targeting the new platform features and APIs (as soon as possible after final release)

This page outlines the general steps for each of those phases. When you're ready to get started, read Get Android 11.

Ensure compatibility with Android 11

It's important to test the functionality of your existing app against Android 11 to ensure a great experience for users updating to the latest version of Android. Some platform changes can affect the way your app behaves, so it's important to test early and thoroughly, then make any needed adjustments to your app.

Typically you can adjust your app and publish an update without needing to change the app's targetSdkVersion.

Similarly, you should not need to use new APIs or change its compileSdkVersion, although this can depend on the way your app is built and the platform functionality it's using. Below are the steps.

Before you get started, make sure to familiarize yourself with the behavior changes that might affect your app, even if you don't change its targetSdkVersion.

Perform compatibility testing

For the most part, testing compatibility with Android 11 is similar to the type of testing you otherwise perform when preparing to release your app. This is a good time to review the core app quality guidelines and best practices for testing.

Note, however, that Android 11 introduces new privacy changes to the Android platform that can affect your app's behavior or break the app, even if you do not change your targetSdkVersion. For this reason, it is important that you review the key privacy changes, and test any fixes that you implement to accommodate the changes.

For a more extensive list of behavior changes for all apps running on Android 11, see the behavior changes page.

Update your target version and use Android 11 features

This section explains how to enable full support for Android 11 by updating your targetSdkVersion to R and adding new features from Android 11.

In addition to offering you new APIs, Android 11 introduces some behavior changes when you update your targetSdkVersion to R. Because some behavior changes might require changes to your app's code to avoid breakage, you should first understand how your app might be affected when you change the targetSdkVersion by reviewing all behavior changes for apps targeting Android 11.

Get the Android 11 SDK

To download the SDK packages required to build your app with Android 11, be sure to use the latest preview version of Android Studio. To learn more, see Set Up the Android 11 SDK.

Test your Android 11 app

Once you've completed your setup, you can build your app and then perform further testing to ensure that your app works properly when targeting Android 11. Be sure to review the core app quality guidelines and best practices for testing.

When you build and test your app with the targetSdkVersion set to R, be sure to keep the Android 11 behavior changes in mind. Some of these changes can significantly affect your app's behavior or even break your app completely, even if you do not implement new features when targeting Android 11.

After you've tested and confirmed that your app's existing functionality works as expected on Android 11, you can then explore and implement new Android 11 features and APIs.