Hi, welcome to our session on What’s New in Android Development Tools.
I'm Jamal, a Product Manager on the Android Studio team.
Today, I'll cover a few things.
First, I'll talk about the roadmap
and some of the features you may have missed since last year.
And then, we’ll spend some time talking about the latest in design tools.
Next, we will explore tools to help scale your app to new device types and screens.
And lastly, we’ll talk about some of the features we’ve added
that are focused on making you more productive as an Android developer.
All right, let’s jump into the roadmap.
Since the Android Dev Show we hosted last year, we released Android Studio 4.1.
This release included a brand new live Database Inspector.
In real-time, you can make changes to your app’s database
and see them reflected immediately.
Additionally, this release included support
for importing TensorFlow Lite models directly into your project,
plus a brand new native C++ memory profiler.
Last, we’ll be spending good amount of time focused on quality for the product,
since quality is a feature for us.
Next, in Android Studio 4.2, we launched the Project Upgrade Assistant
to help you migrate your projects to use the latest Android Gradle plugin.
We also released support for Safe Args
and did a large overhaul to the backend of the Apply Changes feature.
Another update we made is a change to the version schema of Android Studio.
Instead of using a random decimal number for versions,
we migrated to a year-based versioning to align with the IntelliJ version system.
The major difference over the IntelliJ version system
is that the last digit, in this case .1, represents the Studio major version.
Now, we know keeping track of strings of numbers can be confusing,
so we additionally added a co-name to each release
that will increment alphabetically with each major version of Android Studio.
To that end, our first release in 2021, is Android Studio Arctic Fox.
Along with the versioning change and the ID, we have also lined the version system
of the Android Gradle plugin to Gradle as well.
What this means is that the Android Gradle plugin version for your app project
is not tied to your Android Studio version.
And so you can now update to the latest Canary or stable version
without worrying about affecting the build output of your app project.
All right, let’s move on to some updates on design tools.
For this section, I will first give a quick demo
of some of the features in this area.
You can grab the samples that I’m going over today via the samples browser.
First, I will show you Live Literals with Jetpack Compose,
which allows you to edit the literals in your app in near real-time.
Note, as I am typing in my source code editor,
the running app automatically is reflecting the changes that I’m making in the UI.
It also helps to check your UI in different states
while developing things like light and dark themes.
This is where the preview comes in handy.
In this case, I've already defined a light and dark theme in my app.
For this third screen, let’s transform this preview into a landscape orientation.
To aid with this, we have a Compose preview configuration picker
that I can first add a custom preview name to,
then I can add a custom width and height to create a landscape preview.
And in a moment or two, the preview updates to my custom configuration.
Let’s say you’re using ConstraintLayout in your Compose app.
We are actively working to bring many of your favorite XML preview tools,
like blueprint mode and constraint preview into Compose.
Another design area we have been working on is animation.
So for simple animated vector drawables, I just simply press Play,
and you can then confirm your drawable is working as intended.
Looking back at Compose, first, we have the interactive preview,
which allows you to test gestures and inspect animations.
So for this large animation, I can simply drag the cards
to make sure the animation is working correctly.
If I want to drill into a specific card, I can.
Just click on the individual topic card.
I can click on the “start animation inspection” button.
Once I zoom in a bit, I can get a clear picture of the target animation.
I can then slow down and repeat the animation,
and then simply press Play.
And since this is on a timeline,
I can grab the indicator and scrub frame by frame through my animation.
That was quick, but I hope it gave you an idea
of some of the cool things you can do with our design tools’ updates.
On top of Compose design tools, you should also check out recent updates
we have made to the motion editor, including motion and animation.
Plus take a look at the integration of the accessibility test framework scanner,
which will help you make designs that are more accessible during design time.
Next, we'll talk about devices.
From the beginning, Android Studio has enabled you to extend your app
to new Android device types and screen sizes.
We've made some recent enhancements you should be aware of
to better your app to work across even more devices.
Let me show you a few examples.
So for this demo, let’s assume we’re trying to make sure this app,
which has nested navigation fragments, works well on tablets and landscape devices.
Once you have your initial design complete,
it is helpful first to make sure your layout works in landscape orientation.
To focus on preview, I can temporarily hide the code editor,
and trigger the device orientation, and scroll through the content.
I can also open up the Layout Validation tool
to see how my app looks across resolutions and screen sizes.
As I scroll down, my layout looks pretty good across each screen size,
but I can probably do a better layout for a tablet.
To do this, let me close this window and switch to tablet fragment.
Here, I have a tablet-specific layout that looks a bit better for tablets.
In order to keep my layouts across screen sizes in sync,
Android Studio has a convenient preview menu
that allows me to easily navigate between related large screen layouts.
To validate my work, I can also run my app in the Android emulator.
This is handy, particularly for new device types like foldables,
where I need to ensure that the content nicely transitions between each screen state.
Next, we’re also very excited about Wear OS 3.
When developing a layout with XML,
you can of course edit and preview layouts in Android Studio.
However, a new thing we added to Arctic Fox
is better support for pairing your Wear OS device,
which we know can be a critical pain point in your development flow.
So instead of having to rifle with ADB command flags,
we now have a new assistant wizard
that will walk you through the new app developer pairing flow.
Another pain point we have heard from you,
was the lack of Wear OS-specific sensors in the emulator.
For example, if you use the Heart Rate API, there’s no previous way to test the sensor
without getting a physical device.
Now, with the latest Wear OS emulator, you can call on the Heart Rate API directly
and control the input right inside of the virtual sensors controls.
The last device update I would like to show you is on Android TV.
You can now download emulator system images that have the Google TV experience built in.
We now have a updated remote control panel, which has mapping for the new Google TV,
remote control features like user profile, and settings.
While we are in the IDE, I want to also give you a sneak peek
at the upcoming device manager,
which will help you better manage using all the Android device types,
both virtual and physical devices in one compact UI.
Lastly, check out USB Passthrough for Android Auto,
which allows you to hook up a phone directly via USB to an Android Auto emulator.
So, as you can see from the demos, Android Studio has tools in place
for each of your Android device form factors you focus on.
So for making sure your app extends to tablets and foldables,
to making new apps for Wear OS 3.0 devices,
the latest version Android Studio has tools to help you be more productive.
Speaking of productive, Android Studio Arctic Fox has a ton of new features
focused on making you more productive as an app developer.
Let me show you a few things you don't want to miss.
The first thing I will show you is a new testing tool called Test Retention,
which uses Android emulator snapshots, which can capture test state failures.
First, you have to have some basic instrumentation tests
already defined in your project.
Then, to enable this feature,
you need to add the failureRetention block to your build.gradle file.
Note you need to specify how many emulators snapshots that you want to create.
Once that is set up, open up the terminal inside of Android Studio
and run gradlew connectedCheck, as highlighted in the IDE.
Running this command triggers instrumented tests
and creates a bundle of executed tests
and even the snapshots of failed tests that you can save for review later.
In order to see the results in the IDE, first, click on Run,
then navigate down to Import Tests from File.
Then select the test-results.pb file.
Now you can see the overview picture of all the tests that you have ran.
You can see that these tests have passed, and for the tests that have failed,
you have a new Retention tab at the end of the results.
Once clicked, the failed test and corresponding emulator snapshots
are available for you to replay to help you debug the source of the problem.
Speaking of emulators snapshots, we now allow those who use emulator snapshots
to quickly choose the right snapshot state right from the deployment dropdown.
Now let's talk about profiling.
When you’re optimizing the performance of your app,
check out the updated UI for recording memory events.
To see it, select a session based on device and app.
Then select the memory lane,
select Record Java / Kotlin, then press Record.
Once you’ve stopped recording, you can see the tables of the heap as before,
but note the new mini-timeline,
where you can select the sub-range and drill it into the heap.
Next, let’s switch gears to talk about tools that support WorkManager
In this example, I’m utilizing the WorkManager APIs
to trigger background tasks.
What is tricky sometimes, is that it’s hard to debug what’s happening
with a WorkManager behind the scenes.
To aid with this, open up the app inspection tool window
and click on the WorkManager Inspector.
Next, trigger work manager tasks by clicking on the Go button in the sample app.
And as you can see, the inspector starts tracing all the WorkManager activity.
And when you click on the output, you can further visualize the relationship
between the WorkManager tasks by clicking on the Show Graph Action.
Lastly, we have added a new IDE refactoring tool
that identifies and suggest changes for non-transitive R classes.
If you didn't know, if you have a transitive R class
across two or more project modules in your project,
then you could run into degraded build speed.
To avoid this, you can use this new refactoring tool.
Once refactoring completes, you have an easy summary of proposed refactoring changes.
Okay, I wish I could show you everything new, both big and small,
but there are many features and improvements across the product.
From the code editor, to the build system and more.
So hope you read more about Android Studio Arctic Fox
in our product blogs and release notes.
And that's it.
Android Studio Arctic Fox has a range of features to help you:
one, accelerate your design tasks with Jetpack Compose,
two, test with a range of Android device types and screens,
and three, improve your overall development productivity.
On behalf of the Android Studio team, thanks for watching.
Feel free to check out the other Google I/O tool sessions that offer a deeper dive
into some of the feature areas like design, build and testing tools.
Please download the latest version of Android Studio today
and send us your feedback.
Thanks.