Category Archives: Android Developers Blog

An Open Handset Alliance Project

Answering your top questions on Android Game Development Kit

Posted by Wayne Lu, Technical Lead Manager, Android DevRel

hand holding a phone with game and chat

We launched the Android Game Development Kit (AGDK) in July, and have collected some top questions from developers - ranging from AGDK libraries and tools, optimizing memory in Android, and implementing graphics.


AGDK and game engines

Firstly, we’ve heard questions from early, rising game developers on how to use our set of AGDK libraries and tools. We have the following recommendations depending on your setup:

  1. For game developers using popular game engines such as Defold, Godot, Unity, or Unreal - you can follow our guides to learn how to develop apps on Android. Using these game engines lets you focus on building gameplay instead of the entire technology stack.
  2. If you're using Unreal Engine and targeting multiple platforms such as PC or consoles, Android Game Development Extension (AGDE) may be a great addition to your workflow.
  3. We also support developers who want to customize and write their own game engine - you can learn more about this with our C or C++ documentation.

After choosing your game engine and workflow, you should look into our tools such as the Android Studio Profiler to inspect your game, Android GPU Inspector to profile graphics and Android Performance Tuner to optimize frame rates and loading times.


Game Mode API and Interventions

Following this, we’ve received questions on developing for Android 12. While you don’t have to do anything special for your game to run on Android 12, we’ve introduced Game Mode API and interventions to help players customise their gaming experience.

  1. Read more about the Game Mode API, and find out how to optimize your game for the best performance or longest battery life when the user selects the corresponding game mode.
  2. Learn about the Game Mode interventions - these are set by original equipment manufacturers (OEMs), to improve the performance of games that are no longer being updated by developers. For example: WindowManager backbuffer resize to reduce a device's GPU load.

Memory Access in Android

Secondly, you’ve asked us how memory access works in Android game development versus Windows. In short, here are a couple of pointers:

  1. Games need to share memory with the system. Some devices have less available memory than others, so testing is needed to check for low memory issues on a range of supported devices. Testing should be done on devices with typical apps that a user would have installed (i.e. not a clean device).
  2. The amount of memory a game can allocate depends on various factors such as the amount of physical memory, the number of dirty pages, and the amount of total zRam (for compressed swapping)
  3. Symptoms of low memory can be: onTrimMemory() calls, memory thrashing, or termination of the game by the Low Memory Killer. Use bugreport logs to check if the game was killed by the Low Memory Killer, or on Android 11 and later check the ApplicationExitInfo to see if the game was terminated because of REASON_LOW_MEMORY.
  4. Avoid memory thrashing: this occurs when there’s low but insufficient memory to kill the game. You can detect this via system tracing, and should reduce the overall memory footprint to avoid this issue.
  5. Use the Android Profiler and other tools to inspect your memory usage.

Implementing Graphics in Android

Thirdly, we’ve received questions about implementing graphics in Android. You have the following options: OpenGL ES or Vulkan graphics APIs:

  1. Learn how to configure OpenGL ES graphics for your C++ game engine by initializing variables, rendering with the game loop, scenes and objects.
  2. Read our Vulkan guides to learn how to draw a cube, compile shaders, setup validation layers, and other best practices.

Check out the Q&A video to view the top questions on AGDK and visit g.co/android/AGDK for our latest resources for Android game development.

Mindful architecture: Headspace’s refactor to scale

Posted by Manuel Vicente Vivo, Android Developer Relations Engineer

Contributors: Mauricio Vergara, Product Marketing Manager, Developer Marketing, Marialaura Garcia, Associate Product Marketing Manager, Developer Marketing

Headspace Technical case study graphic


Executive Summary

Headspace was ready to launch new wellness and fitness features, but their app architecture wasn’t. They spent eight months refactoring to a Model-View-ViewModel architecture, rewriting in Kotlin and improving test coverage from 15 to 80%. The improved app experience increased MAU by 15% and increased review scores from 3.5 to 4.7 between Q2 and Q4 of 2020. To learn more about how Headspace’s focus on Android Excellence impacted their business, read the accompanying case study here.


Introduction

Headspace has grown into a leader in mindfulness by creating an app which helps millions of people to meditate daily. Mindfulness goes far beyond meditation, it connects to all aspects of a person’s life. That idea prompted the most recent stage in Headspace’s evolution. In 2019, they decided to expand beyond meditation and add new fitness and wellness features to their Android app. Headspace realized that they would need a cross-functional team of engineers and designers to be able to deliver on the new product vision and create an excellent app experience for users. An exciting new phase for the company: their design team started the process by creating prototypes for the new experience, with fresh new designs.

With designs in hand, the only thing stopping Headspace from expanding their app and broadening users’ horizons was their existing Android software architecture. It wasn’t well structured to support all these new features. Headspace’s development team made the case to their leadership that building on the existing code would take longer than a complete rewrite. After sharing the vision and getting everyone on board, the team set out on a collective journey to write a new Android app in pursuit of app excellence.


The Android Rewrite

Headspace’s Android development team first needed a convenient way to standardize how they built and implemented features. "Before we wrote a single line of code, our team spent a week evaluating some important implementation choices for the foundation of our app,” Aram Sheroyan, an Android developer at Headspace explains;

“This was crucial pre-work so that we were all on the same page when we actually started to build."

Immersing themselves in Google’s literature on the latest, best practices for Android development and app architecture, the team found a solution they could all confidently agree on. Google recommended refactoring their app using a new base architecture: model-view-view-model. MVVM is a widely-supported software pattern that is progressively becoming industry standard because it allows developers to create a clear separation of concerns, helping streamline an app’s architecture. “It allowed us to nicely separate our view logic," Sheroyan explained.

With MVVM as the base architecture, they identified Android’s Jetpack libraries, including Dagger and Hilt for dependency injection. The new tools made boilerplate code smaller and easier to structure, not to mention more predictable and efficient. Combined with MVVM, the libraries provided them with a more detailed understanding of how new features should be implemented. The team was also able to improve quality in passing arguments between functions. The app had previously suffered from crashes due to NullPointerException errors and incorrect arguments. Adopting the safeArgs library helped to eliminate errors when passing arguments.

In rewriting the app, the team further made sure to follow the Repository pattern to support a clearer separation of concerns. For example, instead of having one huge class that saves data in shared preferences, they decided that each repository’s local data source should handle the respective logic. This separation of data sources enables the team to test and reproduce business code outside of the live app for unit testing without having to change production code. Separating concerns in this way made the app more stable and the code more modular.

The team also took the opportunity to fully translate their app into the Kotlin programming language, which offered useful helper functions, sealed classes, and extension functions. Removing legacy code and replacing the mix of Java and Kotlin with pure Kotlin code decreased build time for the app. The new architecture also made it easier to write tests and allowed them to increase test coverage from around 15% to more than 80%. This resulted in faster deployments, higher quality code, and fewer crashes.

To capture the new user experience in the app’s reviews, Headspace implemented the Google Play In-App Review API. The new API allowed them to encourage all users to share reviews from within the app. The implementation increased review scores by 24%, and — as store listing reviews are tied to visibility on Google Play — helped draw attention to the app’s recent improvements.


Achieving App Excellence

The rewrite took eight months and with it came a new confidence in the code. Now that the codebase had 80%+ unit test coverage, they could develop and test new features with confidence rather than worries. The new architecture made this possible thanks to its improved logic separation, and a more reusable code, making it easier to plan and implement new features.

The build time for the app decreased dramatically and development velocity picked up. The team’s new clarity around best practices and architecture also reduced friction for onboarding new developers, since it was now based on Android industry standards. They could communicate more clearly with potential candidates during the interview process, as they now had a shared architectural language for discussing problem sets and potential solutions.

With velocity came faster implementation of features and an improved retention flow. They could now optimize their upsell process, which led to a 20% increase in the number of paid Android subscribers relative to other platforms where the app is published. The combination of a new app experience and the implementation of the new In-App Review API led to their review scores improving from 3.5 to 4.7 stars between Q2 and Q4 of 2020! Overall, the new focus on Android App Excellence and the improved ratings earned Headspace a 15% increase in MAU globally..

These were just a few of the payoffs from the significant investment Headspace made in app excellence. Their laser focus on quality paid off across the board, enabling them to continue to grow their community of users and lay a solid foundation for the future evolution of their app experience.


Get your own team on board

If you’re interested in getting your team on board for your own App Excellence journey, check out our condensed case study for product owners and executives linked here. To learn more about how consistent, intuitive app user experiences can grow your business, visit the App Excellence landing page.

Android Dev Summit returns on October 27-28, 2021!

Posted by the Android Team

Header with text saying Android Dev Summit 2021 October 27-28

The Android Dev Summit is back! In just a few weeks, join us October 27-28 to hear about the latest updates in Android development. This year’s theme is Excellent apps, across devices, and you can learn about the development tools, APIs and technology to help you be more productive and create better apps that run across billions of devices, including tablets, wearables and more.

The show kicks off at 10 AM PT on October 27 with The Android Show: a technical keynote where you’ll hear all the latest news and updates for Android developers. From there, we have over 30 sessions on a range of technical Android development topics. Plus, we’ve assembled the team that builds Android to get your burning #AskAndroid questions answered live. This year’s Android Dev Summit will be your opportunity to connect digitally with Android developers around the world.

Interested in learning more? Be sure to sign up for updates through our newsletter here.

Improved Google Play Console user management: access requests, permission groups, and more

Posted by Mike Yerou, Software Engineer, Google Play

PlayConsole revamped user management header

User management is an important responsibility for businesses of all sizes. The challenge is to make sure that every team member has the right set of permissions to fulfill their responsibilities, but without overexposing unrelated business data.

Over the years, you’ve asked us for better user and permission management tools in Play Console to help you handle growth efficiently and with confidence. And with the redesigned Google Play Console, we did just that. We decluttered the interface to make it easier to find what you want, and added new features to help you manage your teams easier.


Users and Permissions screen

The users and permissions page has been redesigned to make it easier for admins to manage their teams.


Permission names and descriptions were rewritten to make it easier to understand what you are — and aren’t — allowing users to do. You’ll also see clearer differentiation between account and app-level permissions.

New search, filtering, and batch-editing capabilities allowed you to quickly view and act on a subset of users.

And finally, to make auditing easier, we added a CSV export functionality for users of a developer account.


New access requests

While admins generally set permissions for users, you told us it would be helpful to allow users to request permissions as they figure out what’s required for their workflow. Well, now they can. Admins will still need to approve the request, but empowering users to ask for the exact permissions they need is a significant time-saver for admins.

In Play Console, users will now see a “Request access” button next to each action that is supported but not enabled due to missing permissions. To request the permission, users need to include an explanation of their need to the admin. Admins will be notified via their Inbox and can grant the permission for the specific user and app, reject it once, or reject it permanently to prevent users misusing the feature. Currently, this function is only supported for app permissions.


Request access GIF

Team members can now request access for specific permissions.


New permission groups

When companies reach a certain size, it’s not uncommon for more than one person to have the same role, such as project managers or designers. When that happens, admins may find themselves assigning the same set of permissions over and over again.

To save you time, we recently introduced permission groups. Admins can now create a group with a set of permissions, and when a user is added to that group, they will inherit those permissions automatically. You can even choose to have the permissions in that group expire after a certain date. Users can be in multiple groups, and these groups can have overlapping permissions. We hope you’ll be able to use permission groups to improve your own working practices and encourage greater delegation and ease of user management.

We hope these new changes help you improve admin productivity and help your team get the most out of Play Console. To learn more about managing permissions, check out our Help Center.


How useful did you find this blog post?

Google Play logo

Making permissions auto-reset available to billions more devices

Posted by Peter Visontay, Software Engineer; Bessie Jiang, Software Engineer

Contributors: Inara Ramji, Software Engineer; Rodrigo Farell, Interaction Designer; James Kelly, Product Manager; Henry Chin, Program Manager.

Illustration of person holding phone

Most users spend a lot of time on their smartphones. Whether working, playing games, or connecting with friends, people often use apps as the primary gateway for their digital lives. In order to work, apps often need to request certain permissions, but with dozens of apps on any given device, it can be tough to keep up with the permissions you’ve previously granted – especially if you haven’t used an app for an extended period of time.

In Android 11, we introduced the permission auto-reset feature. This feature helps protect user privacy by automatically resetting an app’s runtime permissions – which are permissions that display a prompt to the user when requested – if the app isn’t used for a few months. Starting in December 2021, we are expanding this to billions more devices. This feature will automatically be enabled on devices with Google Play services that are running Android 6.0 (API level 23) or higher.

The feature will be enabled by default for apps targeting Android 11 (API level 30) or higher. However, users can enable permission auto-reset manually for apps targeting API levels 23 to 29.

So what does this mean for developers?


Exceptions

Some apps and permissions are automatically exempted from revocation, like active Device Administrator apps used by enterprises, and permissions fixed by enterprise policy.


Request user to disable auto-reset

If needed, developers can ask the user to prevent the system from resetting their app's permissions. This is useful in situations where users expect the app to work primarily in the background, even without interacting with it. The main use cases are listed here.


Comparing current and new behavior

Current behavior New behavior
Permissions are automatically reset on Android 11 (API level 30) and higher devices. Permissions are automatically reset on the following devices:
  • Devices with Google Play services that are running a version between Android 6.0 (API level 23) and Android 10 (API level 29), inclusive.
  • All devices running Android 11 (API level 30) and higher devices.
Permissions are reset by default for apps targeting Android 11 or later. The user can manually enable auto-reset for apps targeting Android 6.0 (API level 23) or later. No change from the current behavior.
Apps can request the user to disable auto-reset for the app. No change from the current behavior.


Necessary code changes

If an app targets at least API 30, and asks the user to disable permission auto-reset, then developers will need to make a few simple code changes. If the app does not disable auto-reset, then no code changes are required.

Note: this API is only intended for apps whose targetSDK is API 30 or higher, because permission auto-reset only applies to these apps by default. Developers don’t need to change anything if the app‘s targetSDK is API 29 or lower.

The table below summarizes the new, cross-platform API (compared to the API published in Android 11):

Action Android 11 API
(works only on Android 11 and later devices)
New, cross-platform API
(works on Android 6.0 and later devices, including Android 11 and later devices)
Check if permission auto-reset is enabled on the device Check if Build.VERSION.SDK_INT >= Build.VERSION_CODES.R Call androidx.core.content.PackageManagerCompat.getUnusedAppRestrictionsStatus()
Check if auto-reset is disabled for your app Call PackageManager.
isAutoRevokeWhitelisted()
Call androidx.core.content.
PackageManagerCompat.
getUnusedAppRestrictionsStatus()
Request that the user disable auto-reset for your app Send an intent with action
Intent.ACTION_AUTO_REVOKE_PERMISSIONS
Send an intent created with androidx.core.content.
IntentCompat.
createManageUnusedAppRestrictionsIntent()


This cross-platform API is part of the Jetpack Core library, and will be available in Jetpack Core v1.7.0. This API is now available in beta.

Sample logic for an app that needs the user to disable auto-reset:

val future: ListenableFuture<Int> =
    PackageManagerCompat.getUnusedAppRestrictionsStatus(context)
future.addListener(
  { onResult(future.get()) },
   ContextCompat.getMainExecutor(context)
)

fun onResult(appRestrictionsStatus: Int) {
  when (appRestrictionsStatus) {
    // Status could not be fetched. Check logs for details.
    ERROR -> { }

    // Restrictions do not apply to your app on this device.
    FEATURE_NOT_AVAILABLE -> { }
    // Restrictions have been disabled by the user for your app.
    DISABLED -> { }

    // If the user doesn't start your app for months, its permissions 
    // will be revoked and/or it will be hibernated. 
    // See the API_* constants for details.
    API_30_BACKPORT, API_30, API_31 -> 
      handleRestrictions(appRestrictionsStatus)
  }
}

fun handleRestrictions(appRestrictionsStatus: Int) {
  // If your app works primarily in the background, you can ask the user
  // to disable these restrictions. Check if you have already asked the
  // user to disable these restrictions. If not, you can show a message to 
  // the user explaining why permission auto-reset and Hibernation should be 
  // disabled. Tell them that they will now be redirected to a page where 
  // they can disable these features.

  Intent intent = IntentCompat.createManageUnusedAppRestrictionsIntent
    (context, packageName)

  // Must use startActivityForResult(), not startActivity(), even if 
  // you don't use the result code returned in onActivityResult().
  startActivityForResult(intent, REQUEST_CODE)
}

The above logic will work on Android 6.0 – Android 10 and also Android 11+ devices. It is enough to use just the new APIs; you won’t need to call the Android 11 auto-reset APIs anymore.


Compatibility with App Hibernation in Android 12

The new APIs are also compatible with app hibernation introduced by Android 12 (API level 31). Hibernation is a new restriction applied to unused apps. This feature is not available on OS versions before Android 12.

The getUnusedAppRestrictionsStatus() API will return API_31 if both permission auto-reset and app hibernation apply to an app.


Launch Timeline

  • September 15, 2021 - The cross-platform auto-reset APIs are now in beta (Jetpack Core 1.7.0 beta library), so developers can start using these APIs today. Their use is safe even on devices that don’t support permission auto-reset (the API will return FEATURE_NOT_AVAILABLE on these devices).
  • October 2021 - The cross-platform auto-reset APIs become available as stable APIs (Jetpack Core 1.7.0).
  • December 2021 - The permission auto-reset feature will begin a gradual rollout across devices powered by Google Play Services that run a version between Android 6.0 and Android 10. On these devices, users can now go to the auto-reset settings page and enable/disable auto-reset for specific apps. The system will start to automatically reset the permissions of unused apps a few weeks after the feature launches on a device.
  • Q1 2022 - The permission auto-reset feature will reach all devices running a version between Android 6.0 and Android 10.

App performance to drive app excellence

Posted by Maru Ahues Bouza, Director Android Developer Relations

hand drawing shapes on a tablet

In our previous blog post in this series, we defined app excellence as “creating an app that provides consistent, effortless, and seamless app user experiences. It is high performing and provides a great experience, no matter the device being used.” Let’s focus on the concept of app performance — what are the features of high performing apps, and how do you achieve app excellence through strong performance?

From a user’s perspective, high-performing apps “just work.” However, the process of creating a high performing app is not always straightforward. To break things down, here are the main dimensions of high performance:

Stability

An app should be robust and reliable. It should not freeze (application not responding, or “ANR”) or crash. Before you launch your app, check out Google Play’s pre-launch report to identify potential stability issues. After deployment, pay attention to the Android Vitals page in the Google Play developer console. Specifically, ANRs are caused by threading issues. The ANR troubleshooting guide can help you diagnose and resolve any ANRs that exist in your app.

Quick loading

Imagine the first experience a user has of your app is…..waiting. At some point, they are going to get distracted or bored, and you have lost a new user. Your app should either load quickly or provide some sort of feedback onscreen such as a progress indicator. You can use data from Android vitals to quantify any issues you may have with start up times. Android vitals considers excessive start up times as:

  • Cold startup takes 5 seconds or longer.
  • Warm startup takes 2 seconds or longer.
  • Hot startup takes 1.5 seconds or longer.

However, these are relatively conservative numbers. We recommend you aim for lower. Here are some great tips on how to test start up performance.

Fast rendering

High quality frame rendering is not just for games. Smooth visual experiences that don’t stall or act sluggish are also important for apps. At a minimum aim to render frames every 16ms to achieve 60 frames per second, but bear in mind there are devices in the market with faster refresh rates. To monitor performance as you test, use the Profile HWUI rendering option. Here are tools to help diagnose rendering issues.

Economical with battery usage

As soon as a user realizes your app is draining their battery, they are going to consider uninstalling. Your app can drain battery through stuck partial wake locks, excessive wakeups, background Wifi scans, or background network usage. Use the Android Studio energy profiler combined with planned background work, to diagnose unexpected battery use. For apps that need to execute background tasks that require a guarantee that the system will run them even if the app exits, WorkManager is a battery friendly Android Jetpack library that runs deferrable, guaranteed background work when the work’s constraints are satisfied.

Using up-to-date SDKs

For both security and performance, it’s important that any Google or third-party SDKs used are up-to-date. Improvements to these SDKs, such as stability, compatibility, or security, should be available to users in a timely manner. You are responsible for the entire code base, including any third party SDKs you may utilize. For Google SDKs, consider using SDKs powered by Google Play services, when available. These SDKs are backward compatible, receive automatic updates, reduce your app package size, and make efficient use of on-device resources.

To learn more, please visit the Android app excellence webpage, where you will find case studies, practical tips, and the opportunity to sign up for our App Excellence summit..

In our next blog posts, we will talk about seamless user experiences across devices. Sign up to the Android developer newsletter here to be notified of the next installment and get news and insights from the Android team.

Wear OS Jetpack libraries now in stable!

Posted by Jeremy Walker, Engineer

jetpack banner

In order to help you develop high quality Wear OS apps, we have been busy updating the Android Jetpack Wear OS libraries and recently delivered the first five stable Jetpack Wear OS libraries:

Library Featured functionality
wear Lay out elements in an arch to support round watches (ArcLayout) and write curved text following the curvature of a device (CurvedText).
wear-input Identify and interact with hardware buttons on the Wear OS device.
wear-ongoing Surface Ongoing Notifications in new Wear specific surfaces (code lab).
wear-phone-interactions Detect the type of phone a watch is paired with (iOS or Android) and handle all Notification bridging options.
wear-remote-interaction Open Android intents on other devices, for example, when a user wants the app on both the phone and watch, open the Play Store on a device where your app isn't installed.

How these compare to the Wearable Support library

The Android Jetpack Wear OS libraries contain all the familiar functionality you’ve grown used to in the old Wearable Support library, better support for Wear OS 3.0, and the features listed above (many of which are written 100% in Kotlin).

As always with Android Jetpack, the new Wear OS libraries help you follow best practices, reduce boilerplate, and create performant, glanceable experiences for your users.

The core stable libraries are available now. The Watch Face and Complications libraries are in alpha and will be released as stable later this year. Once that launches, the Wearable Support Library will officially be deprecated.

We strongly recommend you migrate the libraries within your Wear OS apps from the Wearable Support library to their AndroidX equivalents as we make them available in stable.

Note: The Android Jetpack libraries are meant to be replacements for the Wearable Support Libraries and aren't designed to be used together.

Try them out and let us know what you think!

Thank you!

Bringing richer navigation, charging, parking apps to more Android Auto users

Posted by Madan Ankapura, Product Manager

Illustration of car interior with map, parking and gas symbols

Today, we are releasing the beta of Android for Cars App Library version 1.1. Your Android Auto apps using features that require Car App API level 2+ like map interactivity, vehicle’s hardware data, multiple-length text, long message and sign-in templates, can now be used in cars with Android Auto 6.7+ (which were previously limited to Desktop Head Unit only).

Two Android Auto GIF examples. Left GIF is 2GIS and right GIF is TomTom

With this announcement, we are also completing the transition to Jetpack and will no longer be accepting submissions built with the closed source library (com.google.android.libraries.car.app). If you haven’t already, we encourage you to migrate to the AndroidX library now.

For the entire list of changes in beta01, please see the release notes. To start building your app for the car, check out our updated developer documentation, car quality guidelines and design guidelines.

If you’re interested in joining our Early Access Program to get access to new features early in the future, please fill out this interest form. You can get started with the Android for Cars App Library today, by visiting g.co/androidforcars.

Android 12 Beta 5 update, official release is next!

Posted by Dave Burke, VP of Engineering

Android 12 logo

We’re just a few weeks away from the official release of Android 12! As we put the finishing touches on the new version of Android, today we’re bringing you a final Beta update to help you with testing and development. For developers, now is the time to make sure your apps are ready!

You can get Beta 5 today on your Pixel device, including on the Pixel 5a with 5G, by enrolling here for over-the-air updates. If you’re already enrolled, you’ll automatically get the update. You can also try Android 12 Beta 5 on select devices from several of our partners like Sharp. Visit the Android 12 developer site for details.

Watch for more information on the official Android 12 release coming soon!

What’s in Beta 5?

Today’s update includes a release candidate build of Android 12 for Pixel and other devices and the Android Emulator. We reached Platform Stability at Beta 4, so all app-facing surfaces are final, including SDK and NDK APIs, app-facing system behaviors, and restrictions on non-SDK interfaces. With these and the latest fixes and optimizations, Beta 5 gives you everything you need to complete your testing.

timeline

Get your apps ready!

With the official Android 12 release coming next, we’re asking all app and game developers to complete your final compatibility testing and publish your compatibility updates ahead of the final release. For SDK, library, tools, and game engine developers, it’s important to release your compatible updates as soon as possible -- your downstream app and game developers may be blocked until they receive your updates.

To test your app for compatibility, just install it on a device running Android 12 Beta 5 and work through the app flows looking for any functional or UI issues. Review the Android 12 behavior changes for all apps to focus on areas where your app could be affected. Here are some of the top changes to test:

  • Privacy dashboard — A new dashboard in Settings lets users see which apps are accessing which type of data and when. Users can adjust permissions if needed, and they can request details from your app on the reason for access. More here.
  • Microphone & camera indicators — Android 12 shows an indicator in the status bar when an app is using the camera or microphone. More here.
  • Microphone & camera toggles — New toggles in Quick Settings let users instantly disable microphone and camera access for all apps. More here.
  • Clipboard read notification — A toast alerts users when an app reads data from the clipboard unexpectedly. More here.
  • Stretch overscroll — A new “stretch” overscroll effect replaces the previous “glow” overscroll effect systemwide. More here.
  • App splash screens — Android 12 launches apps with a new splash screen animation. More here.
  • Keygen changes — Several deprecated BouncyCastle cryptographic algorithms are removed in favor of Conscrypt versions. If your app uses a 512-bit key with AES, you’ll need to use one of the standard sizes supported by Conscrypt.More here.

Remember to test the libraries and SDKs in your app for compatibility. If you find any SDK issues, try updating to the latest version of the SDK or reaching out to the developer for help.

Once you’ve published the compatible version of your current app, you can start the process to update your app's targetSdkVersion. Review the behavior changes for Android 12 apps and use the compatibility framework to help detect issues quickly.

Explore the new features and APIs

Android 12 has a ton of new features to help you build great experiences for users. Check out our Android 12 Beta 2 post for a recap and links to Android 12 talks at Google I/O. For complete details on all of the new features and APIs, visit the Android 12 developer site.

Also make sure to try Android Studio Arctic Fox with your Android 12 development and testing. We’ve added lint checks to help you catch where your code might be affected by Android 12 changes, such as for custom declarations of splash screens, coarse location permission for fine location usage, media formats, and high sensor sampling rate permission. You can give these a try by downloading and configuring the latest version of Android Studio.

Get started with Android 12!

Today’s Beta 5 release has everything you need to try the Android 12 features, test your apps, and give us feedback. Just enroll any supported Pixel device to get the update over-the-air. To get started developing, set up the Android 12 SDK.

You can also get Beta 5 on devices from several of our partners like Sharp. For even broader testing, you can try Beta 5 on Android GSI images, and if you don’t have a device, you can test on the Android Emulator. This update is also available for Android TV, so you can check out the latest TV features and test your apps on the all-new Google TV experience.

What’s next?

Stay tuned for the official Android 12 launch coming in the weeks ahead! Until then, feel free to continue sharing your feedback through our hotlists for platform issues, app compatibility issues, and third-party SDK issues.

A huge thank you to our developer community for helping shape the Android 12 release! You’ve given us thousands of bug reports and shared insights that have helped us adjust APIs, improve features, fix significant bugs, and in general make the platform better for users and developers.

We’re looking forward to seeing your apps on Android 12!

Accelerated Kotlin build times with Kotlin Symbol Processing 1.0

Posted by Ting-Yuan Huang, Software Engineer and Jiaxiang Chen, Software Engineer

Accelerated Kotlin build times with Kotlin Symbol Processing 1.0 image

Kotlin Symbol Processing (KSP), our new tool for building lightweight compiler plugins in Kotlin, is now stable! KSP offers similar functionality to the Kotlin Annotation Processing Tool (KAPT), however it’s up to 2x faster, offers direct access to Kotlin language constructs, and offers support for multiplatform targets.

Over the past few months, KSP has gone through 32 releases with over 162 bugs reported from the community and fixed by our team. If you were waiting to adopt it, now is the time to check it out.

Why we built KSP

On the Android team, we regularly ask developers: what are your biggest frustrations with writing apps today? One of the top issues that comes up repeatedly is build speed. Over the years we’ve been making steady improvements to the Android build toolchain, and today we’re excited to add to those improvements with KSP. KSP is the next generation of annotation processing in Kotlin: it will dramatically improve build speed for Kotlin developers, and unlike KAPT, it offers support for Kotlin/Native and Kotlin/JS.

Why is KSP faster?

The Kotlin Annotation Processing Tool (KAPT) works with Java’s annotation processing infrastructure to make most Java language annotation processors work in Kotlin out of the box. To do this, KAPT compiles Kotlin code into Java stubs that retain information that Java annotation processors care about. Creating these stubs is costly though, and means the compiler must resolve all the symbols in your program multiple times (once to generate stubs, and then again to do the actual compilation).

KSP moves away from the stub generation model by working as a Kotlin compiler plugin — it allows annotation processors to read and analyze source programs and resources directly in Kotlin instead of requiring you to depend on the Java annotation processing infrastructure. This both dramatically improves build speed (up to 2x faster for Room's Kotlin test app) and means that KSP can be used for non-Android and non-JVM environments like Kotlin/Native and Kotlin/JS.

How to get started

To start using KSP, download the KSP playground project from GitHub, which shows how to use KSP both as an annotation processor and as a consuming app/library:

  • Annotation processor: A toy test-processor library that implements the builder pattern as a KSP processor
  • Consuming library: A workload directory that shows how to use the builder processor in a real-world Kotlin project

If you’re an app developer, check out the list of supported libraries and the quickstart guide for moving a module over from KAPT to KSP.

Using Moshi or Room with KSP

If you’re using Moshi or Room in your project, you can already try out KSP by making a quick fix to your module’s build file. For example, to use the KSP version of Room in a Gradle module you can simply replace the KAPT plugin with KSP and swap out the KSP dependency:

apply plugin: 'com.google.devtools.ksp'

dependencies {
  ...
  implementation "androidx.room:room-runtime:$room_version"
  kapt "androidx.room:room-compiler:$room_version"
  ksp "androidx.room:room-compiler:$room_version"

}

Check out the Room release notes for more info.

Conclusion

With the 1.0 release of KSP you will start to see improved build times for your Kotlin projects as you migrate away from libraries based on KAPT. We have also updated a number of Android specific libraries which are ready for you to try today and offer significant performance improvements.