Now in Android #40 — Special Google I/O edition
Jetpack, Android 12 and privacy, tooling, Kotlin, large screens, Wear OS, Android TV, on-device machine learning, testing, game development, and Google Play!
If you haven’t seen them already, be sure to check out the Google Keynote, the Developer Keynote, and the “What’s new in Android” talk; you’ll learn all about the Android 12 Beta 1 update with its sparkly ripple effect and stretched overscroll, Jetpack Compose hitting 1.0 stable in July, the Material You announcement, Android Studio Arctic Fox reaching beta, Kotlin as the most used language by professional Android devs (used in 80% of top 1,000 apps), or the fact that over 84% of the top 10,000 apps are now using a Jetpack library.
If you haven’t seen them yet, do it now. We’ll wait for you.
Ok! Here we are again. Exciting stuff, eh? Apart from all that, here’s some news that you might have missed from other I/O talks.
TL;DR; of the “What’s new in Jetpack” talk and blog post: CameraX, Hilt, Paging 3, ConstraintLayout, MotionLayout, Security crypto, and Fragment libraries were promoted to stable! DataStore and Compose are in Beta. And there are new libraries we welcome to the Jetpack family:
- AppSearch which is a new on-device search library which provides high performance and feature-rich full-text search functionality.
- Macrobenchmark that extends Jetpack’s benchmarking coverage to app startup and integrated behaviors like scrolling performance. With this API, you can check metrics depending on the compilation mode such as the worst or best case, and the startup mode such as hot, warm, or cold. For more information, check out “Measuring Jank and Startup with Macrobenchmark” talk.
Also, the new version of WorkManager, 2.7 that is now in alpha, targets the Android S SDK and provides additional support for the platform’s new foreground restrictions. See the “Effective Background Tasks on Android” talk for more details.
Ah, I almost forgot about this! If you’re using the Navigation library, make sure to check out the multiple backstacks support in the latest alpha version!
Everyone is excited with Jetpack Compose hitting 1.0 stable in July. But do you know that you don’t have to change your app architecture if you don’t want to when adopting Compose? If you’re interested in this, check out the “Using Jetpack libraries in Compose” talk. Compose comes with integration with the most popular libraries including Navigation, Kotlin flows, Hilt, and more!
Compose also offers an implementation of Material Design. To take advantage of what it offers, check out the “Build beautiful Material Design apps with Jetpack Compose” talk.
The team also released 2 new codelabs: Compose Navigation and Compose Testing. If you’re interested in learning Compose, check out our curated learning path. Bu there’s also the workshop that takes you through the basics of building your first app with Compose in video format.
Android 12 Beta 1 📱
The first beta of Android 12 contains the biggest design changes since we introduced Material Design back in Android 5.0. This includes a substantial refresh to the way app widgets work and look, including dynamic colors that you can apply to your widget by using the system’s theme. Check out the Refreshing Widgets talk for more information. You’ll also want to check out the way your app behaves with the new system-wide stretch overscroll effect, since it only applies to a single scrolling container.
Apps that scan for Bluetooth devices in Android 12 no longer need to hold location permissions if they have the new
BLUETOOTH_SCAN permission with the
neverForLocation attribute. This should both reduce app friction and the number of apps that need the
Speaking of location, users can now select to give your app an approximate location, even if you request the
We pre-announced a bunch of new privacy features that will be in Beta 2, including a user-visible privacy dashboard, new microphone and camera indicators and toggles, and a clipboard read notification. For more on all of the privacy-related changes in Android 12, check out the “What’s New in Privacy” talk.
The beta also introduced performance class, a set of capabilities for devices that can support more demanding use-cases and higher quality content, currently focused around media capabilities.
You can test the Android 12 beta in the emulator, on Pixel 3+ devices, and on select devices from a variety of device partners.
Tooling in Android Studio ❄️🦊
Android Studio Arctic Fox comes with a lot of new stuff and is available in the Beta channel now! It comes with Compose support, great tooling to accelerate Compose development, Layout inspector support for Compose, and a built-in accessibility scanner! But also, the list of supported devices have increased including foldable emulators, remote control for Android TV, pairing wizard for Wear OS, and more. Android Studio also wants to boost your productivity and that’s why the team added a Background Tasks inspector, Kotlin coroutines debugger, and Kotlin Symbol Processing support.
See all of this and more in action in the “What’s new in Android dev tools” talk.
For more in-depth information about the ConstraintLayout and MotionLayout improvements, and the available Compose tooling in Android Studio, check out the “What’s new in design tools” talk.
The Kotlin adoption in the Android devs community is outstanding. We love Kotlin, you love Kotlin,… everyone loves Kotlin! A couple of new things worth mentioning from the “State of Kotlin” talk are Kotlin Symbol Processing, and the new lifecycle APIs to collect flows from the UI layer.
Kotlin Symbol Processing (KSP) aims for faster builds and making symbol processing a first-class feature in the Kotlin ecosystem. No more Java stub generation via KAPT and associated long build times. KSP integrates with the Kotlin Compiler and provides access to all Kotlin symbols. And the best part? KSP has now reached Beta status, which means its API surface is complete. We invite authors of plugins that are currently using KAPT to start migrating to KSP. Our own Jetpack Room Library has KSP support in Beta and we’re seeing 2x faster processing with KSP than we saw through KAPT. KSP was recently featured on the ADB podcast, so make sure to give it a listen if you want to learn more.
The latest version of the
lifecycle-runtime-ktx library includes the
repeatOnLifecycle APIs that are lifecycle-aware. The API is in charge of cancelling and restarting the block of code when the lifecycle reaches or falls below a certain state. This works differently than the
launchWhenStarted API that suspends execution and keeps upstream flows active when the View is in the background. The new APIs help your app be more efficient by not wasting resources in certain scenarios.
With these APIs, we have a complete story for using Flows in Android in all layers of the app. If you’re planning to migrate to Flows, check out the Migrating from LiveData to Kotlin Flows blog post.
Migrating from LiveData to Kotlin’s Flow
In this post you’ll learn how to expose Flows to a view, how to collect them, and how to fine-tune it to fit specific…
Large screens! Wear OS! Android TV! 🖥⌚️
We announced a bunch of things to make it easier to target large-screened devices such as tablets, Chrome OS devices, and foldables, including an updated fold-aware
SlidingPaneLayout that simplifies the implementation of list/detail views, a new vertical navigation rail component for landscape large screens, max width values for commonly over-stretched Material components such as Buttons, TextFields, and Sheets and new guidance. Check out this talk for more.
The next version of Wear is coming, so we have new tooling, including a preview emulator system image, a pairing assistant to simplify pairing Wear emulators to other devices from within Android Studio, and a virtual heart rate sensor. The Ongoing Activities API and Tiles give more ways for users to interact with your app, the new health services platform, created in collaboration with Samsung, is in alpha for you to integrate with, and we have other new Jetpack APIs such as curved text, watch faces, complications, and remote interactions to simplify building for Wear. The “What’s New in Wear” talk explains all this and more.
On Android TV, Cast Connect now has stream transfer and expansion, we have a new emulator running Android 11, and Android 12 Beta 1 is available on ADT-3 devices. Check out the “What’s New in Android TV and Google TV” talk for more about Android on the 80+million active TV devices out there.
On-Device Machine Learning 🤖
We announced that Android’s getting an updatable, fully-integrated ML inference stack. TensorFlow Lite for Android (TFLite) and the Neural Networks API (NNAPI) will now be delivered using Google Play Services, so your app can reduce it’s APK size and take advantage of newer, higher-performance versions without having to publish a new APK.
TFLite, NNAPI, and associated chipset drivers will be updated independent of the platform version, so there should be more consistent drivers and APIs across the Android ecosystem. TFLite 2.3 also adds a compatibility list to help it know where running on the GPU or accelerator is likely to give your model a performance boost.
We announced Automatic Acceleration, which uses that list along with metadata provided by your model to determine whether to run it on a CPU, GPU, or other accelerated backend. For more on all that’s new in on-device ML on Android, head on over to the “What’s New in Android Machine Learning” talk.
In the past, you might’ve seen tests passing on your CI server but failing locally in Android Studio or vice versa. These situations can lead to losing confidence in testing, and obviously affects productivity. One of the reasons was because Android Studio and the Android Gradle plugin implement different versions of the Android instrumented test runner! In Android Studio Arctic Fox, all tests from Android Studio will run through the Android Gradle plugin so that you see a consistent behavior.
Nitrogen? What’s happening with project Nitrogen? I cannot count the number of times we’ve been asked about it. Nitrogen is no longer a thing, welcome the Unified Test Platform (UTP), which is an extensible test executor for running Android tests at scale from Android Studio and the Android Gradle plugin.
One such feature enabled by UTP is Gradle managed virtual devices, which lets you define devices using Gradle DSL. Another feature is running tests across multiple devices in parallel to help improve the scalability of your test execution. Lastly, you can get an emulator snapshot for test failures so that you can restore its state later and see what went wrong.
Learn more about testing in the “What’s new in Android testing tools” talk.
Game Development 🎮
There wasn’t much for game developers at I/O, and that’s largely because of the upcoming online Google for Games Developer Summit on July 12th-13th. You can register for free and learn about all the cool game dev stuff that we didn’t talk about at I/O.
Google Play 🏪
We’ve gotten lots of questions about policy, policy changes, and what to do about policy violations over the years, and now there’s a new Policy and Programs section in the Play Console that brings together policy and enforcement information in one place.
There’s also a new SDK console in Google Play that lets SDK providers report issues such as non-compliant or out of date SDK versions. The Android Gradle Plugin 4.0+ can auto-report which SDK’s your app has as dependencies if you publish using AppBundle, and this allows Play to do things like notify you when an SDK update is recommended. Later in the year, Play will have a new website to help you choose the right SDK for your app.
The Play Billing 4.0 library release enables new features such as multi-quantity purchases and multi-line subscriptions, which bundles multiple products as part of a single subscription. Updates to existing billing-enabled apps will require at least the previous Play Billing 3.0 library as of November 1st of this year, while new apps need to move to Play Billing 3.0+ by August 2nd.
ADB Podcast Episodes 🎧
There have been a couple of episodes of Android Developers Backstage posted since the last Now in Android.
ADB released episode #163, where the whole ADB gang chatted with Nat Duca and Sumir Kataria from the Android graphics team around topics such as shaders, GPUs, Vulkan, OpenGL, ANGLE, drivers, blur, pixels, and, of course, Chet’s favorite topic: colors.
Episode #164 is the first in the new mini-series “AD/BC” on Jetpack Compose which dives deep into different topics in Android’s future UI toolkit. This time, Nick and Chet talked with Adam Powell and Leland Richardson about the Compose compiler, the runtime, data flow, and that nifty feature where Compose knows when to call your Composable based on changes in data state.
Now then… 👋
That’s it for this time. We hope you enjoyed Google I/O this year! Lots of great updates about Jetpack, Android 12 and privacy, tooling, Kotlin, large screens, Wear OS, Android TV, on-device machine learning, testing, game development, and Google Play. Listen to the graphics and Compose podcasts, and please, come back here soon for the next update from the Android developer universe!