11 Weeks of Android: Android 11 Compatibility

Copy paste programmers

Posted by Dirk Dougherty, Android Developer Relations

This blog post is part of a weekly series for #11WeeksOfAndroid. Each week we’re diving into a key area of Android so you don’t miss anything. This week, we spotlighted Android 11 Compatibility; here’s a look at what you should know.

The big news

With Beta 2 now in the hands of users and developers, Android 11 is moving quickly toward the final release later in Q3. For developers, now is the time to make sure your apps are ready! With that in mind, this week we highlighted some resources that can help you get started with app compatibility testing and use some of the new tools in Android 11. Here’s a quick rundown of topics that we covered.

Platform stability

In Android 11 we added a new release milestone called Platform Stability to clearly signal to developers that all APIs and system behaviors are complete. This week, with Beta 2, Android 11 reached Platform Stability, so it’s a great time to do your final compatibility testing and updates. The Beta 2 and Platform Stability blog post goes into more detail on what this milestone means for developers, and you can also read about it in the Android 11 timeline.

App compatibility

As we talked about in our Beta 2 post this week, Android 11 compatibility means that your app is validated to run properly on Android 11 with all of the functionality and features that users expect. To get started, all you need is your app and a device or emulator running Android 11.

When making sure an app is compatible, the goal is to test your app and make the minimum changes to maintain your app’s functionality on Android 11, then publish the compatible version to users by the Android 11 final release. In most cases you should be able to do this without changing your targetSdkVersion or compiling against the new APIs.

It isn’t just for apps and games either – if you develop SDKs, libraries, tools, or even frameworks, now is the time to test those against Android 11 and release a compatible version. App and game developers using your products could be blocked until they can get your Android 11 compatible versions.

For more details on app compatibility, take a look at the migration guide and the list of behavior changes that could affect your apps.

Tools for testing your apps

We highlighted some new tools for you to use as you get started with compatibility testing. Our blog post “Testing app compatibility in Android 11” went into the details.

First is the compatibility framework, a new feature that helps with managing the platform changes that can affect apps. It provides standard metadata for changes, standard gating based on targetSdkVersion, and standard log output to help you identify a change affecting your app. You can toggle behavioral changes in a debuggable app, either through Developer options in Settings or through adb. This helps you isolate changes and test against them individually.

Isolating regressions across devices and API levels can be time-consuming and complex. Now with Android Studio 4.2, you can run instrumentation tests in parallel across multiple physical or virtual devices at once, then compare all of the results in a single Test Matrix. You can run tests on more devices in less time, and catch issues earlier.

Android Generic System Image (GSI) is a great way to expand your Android 11 testing across a broader set of devices and we’ve released an updated Android GSI codelab to help you get started. Through GSI, you can install a generic version of Android 11 on any unlocked, Treble-compliant device that shipped with Android 9 or higher. This includes not only Pixel devices, but many other popular devices in use across the global Android ecosystem.


App compatibility toggles in Developer options.

Ecosystem updates and app compatibility

In our “Accelerating Android updates” blog post, we looked at how we’re continuing to get the latest OS to reach critical mass by expanding Android’s updatability architecture. With technology like Project Treble and Google Play system updates, we can deliver updates across more devices faster, and increase consistency across the ecosystem.

The work we’ve been doing with Project Treble is making it dramatically faster and easier to bring up new versions of Android on new and existing devices. It also makes it possible for device-makers to run their own Developer Preview programs, in some cases in parallel with Android’s own ongoing development. These programs help device makers get their OS updates ready sooner and engage earlier with the Android developer community.

With Google Play system updates (Project Mainline) the goal is to directly update core OS components across devices in the Android ecosystem to improve security, privacy, and consistency across the ecosystem. In Android 11, we’ve added more updatable modules to standardize behaviors in key app-facing areas such as permissions, media, NNAPI, and others.

Other improvements include a Generic Kernel Image (GKI) and Virtual A/B, a new over-the-air update mechanism that combines the benefits of seamless updates with smaller storage requirements. We’re working closely with device makers to bring these to Android 11 devices.

Over time, these will help reduce your development and testing costs to make your app compatible across platform versions and devices.

Taking center stage

A common reason for unexpected app compatibility issues is apps and games depending on Android non-SDK interfaces. In Android 11 we’re continuing our long-term effort to move apps to using public APIs instead.

This week we highlighted Excelliance Tech, who recently moved their LeBian SDK away from non-SDK interfaces, toward stable, official APIs. Their collaboration with the Android team also led to a new public API for resource loading that all developers can use – the ResourcesLoader API in Android 11.

Check out the Excelliance Tech story in this blog post.

The Excelliance Tech team.

What to watch

During Android 11 Compatibility week we posted three short videos to help you plan for compatibility and test your apps. View the playlist here.

The video below gives you a quick overview of Android’s annual release timeline and what the phases mean for developers.


Next, here’s a video that introduces the compatibility framework, a new testing and debugging feature for developers in Android 11. It shows what it is, why it is useful, and how to use it. You’ll walk through an example that shows how you’d enable a specific change, test your app with the change, and then look for the log output to help you identify the change that affected the app.


Last, this video takes you through a new feature in Android Studio that lets you run instrumentation tests in parallel on multiple devices. It shows you how to set up a device set, run tests on the devices, and then jump into the Text Matrix to compare and analyze results. It’s a great way to do your app compatibility testing in Android Studio.

Learning path

If you’re looking for an easy way to pick up the highlights of this week, check out the Compatibility pathway. A pathway is an ordered tutorial that allows users to complete a pre-defined module that culminates in a quiz. A badge is awarded to each user who passes the quiz and can be saved to your Google Developer Profile. Test your knowledge about Android 11 Compatibility to earn a limited edition Android 11 Compatibility badge.

Key takeaways

With each release, we’re working to reduce the impact of compatibility testing on your apps. In Android 11, we’ve added new processes, developer tools, and release milestones to make it easier. We hope the resources we provided this week are helpful as you get started with your compatibility testing. Here are this week’s key takeaways for developers:

  1. Android 11 has reached Platform Stability and all app-facing APIs and behaviors are now complete.
  2. App and game developers should start compatibility testing now and release updates by the Android 11 final release later this year.
  3. SDK, library, and tool developers should complete testing and release compatible versions as soon as possible to avoid blocking downstream developers.
  4. New tools and resources are available to help. See below for highlights and visit developer.android.com/11 for complete details.

Resources

You can find the entire playlist of #11WeeksOfAndroid video content here. We’ll continue to spotlight new areas each week, so keep an eye out and follow us on Twitter and YouTube. Below are the links to resources we talked about during Android 11 Compatibility week.


Blog posts

Testing app compatibility in Android 11

Excelliance Tech: moving to new Android APIs for long-term compatibility

Android 11 Beta 2 and Platform Stability

Accelerating Android updates


Videos

Android 11 Compatibility playlist

Android 11 Compatibility week preview

Testing platform changes in Android 11

Testing app compatibility with Android Studio

Platform Stability and the Android release timeline


Codelabs

Installing Android 11 GSI


Learning Paths

Android 11 – Week 4 – Compatibility


Reddit AMA

Android Platform Team AMA


Related documentation

Android 11 timeline

Get Android 11

Android 11 migration guide

Android 11 behavior changes

Testing app compatibility

Non-SDK restrictions in Android 11

Feedback and issues

Android 11 Developer Site