What’s New in Android Studio 3

Android Studio 3 was recently released – take a quick tour of what’s new! By Aldo Olivares.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 2 of 3 of this article. Click here to view the first page.

Adaptive Icons

A long time ago, smartphones were the only devices running Android. But as Android’s popularity grew, so did the variety of devices using the operating system. Nowadays, there are gadgets ranging from small watches to huge Ultra HD wide screen TV’s.

This is changing the way we approach our app designs, including our app icons.

Android Studio 3 and Android 8.0 (API level 26) introduce the possibility to create Adaptive icons, which can display a variety of shapes and sizes across different devices.

Adaptive icons consist of 2 fundamental pieces:

  • Foreground Layer: The image or logo that represents your app.
  • Background Layer: Your background color or gradient.

Adaptive icons

In Android 7.1 and earlier, icons measured 48 x 48 dp. Now you must size your icon according to the following guidelines:

  • Both layers must measure 108 x 108 dp.
  • The inner 72 x 72 dp of the icon appears within the masked viewport.
  • The system reserves the outer 18 dp on each of the 4 sides to create interesting visual effects, such as parallax or pulsing.

In the next section I will show you how to create adaptive icons using the new and improved Asset Studio in Android Studio 3.

Note: It is highly recommended that you get a custom icon created by a professional designer if you plan to release your app in Google’s Play Store.

Asset Studio

Go back to your emulator’s home screen and look for your app’s icon. You will notice that it is the default one provided by Android Studio:
Default icon

Back in Android Studio 3, right click on your res folder and select New/Image Asset
New Image Asset menu

The Asset Studio will pop up, which allows you to create all kinds of icons and assets for your app.
Asset Studio

In Icon Type you can choose between Launcher Icons (Adaptive and Legacy), Launcher Icons (Legacy only), Action Bar and Tab Icons and Notification Icons. Leave the default option Launcher Icons (Adaptive and Legacy) selected and leave the name as ic_launcher.
Asset Studio menus

Below you have 3 tabs: Foreground Layer, Background Layer and Legacy.

In Foreground Layer you will choose the image that best represents your app. This could be any image that your trusted designer provides you. But for the moment you will use the material icons included with Android.

In Asset Type select Clip Art. Note how the preview is automatically updated:
Clip art

Click on Clip Art
Clip art

A dialog will appear with a large variety of icons to choose from:
Icon chooser

Type moviein the search field and select the one named movie filter:
movie filter icon

Click OK. Your icon should look like this:
Asset Studio update

Now let’s change the color. Click on the hexadecimal code in front of Color:
Color

You can choose a color for your image, either with the Eyedropper, RGB Code, hexadecimal or the color palette.
Color chooser

Choose white by typing FFFFFF in the hexadecimal field:
Hex for white

Click Choose. Your design should look like this:
New icon design

The foreground is completed, now you are going to work on the background.

In the tabs, select Background Layer:
Background layer

We can choose a background image or a solid color. In our case we are going to select Color:
Color background

Click on the color’s hexadecimal code. A dialog will show up just like the one you used to modify the clip art image:
Color chooser

Here you can choose the background color for your app’s icon. I’m going to select purple (4E00A6) because it is my favorite color, but you can choose the one you like the most:
Purple background

Click Choose. Your icon should look like this:
new icon design

Finally, select the Legacy tab:
Legacy tab

Here you can specify if you are going to generate an icon for APIs lower than 25 and what it will look like. Leave the default settings and click Next.

A dialog will ask you to confirm the output directory for your resources. It will also warn you that some files will be overwritten:
New icon dialog

Do not worry about the warning. We want the previous files to be overwritten. Click Finish.

Your res/mipmap folder now contains your own design:
new icon file

Build and Run and check out your brand-new icon:
New app icon

You just created your first adaptive icon using the Asset Studio in Android Studio 3!
Yay!

Android Emulator

Google Play System Images in Android Oreo

Just like for previous API levels, the Android Oreo system image now contains Play Store services. This is very useful to test your apps that make use of several Google APIs like maps and localization.

To create an AVD with Play Store services installed just make sure that you have Google APIs in the device’s target:
Google APIs

Quick Boot

In the early days of Android development, the emulator could take more than an hour to load. Therefore, you had to resort to several hacks or third-party emulators to speed up your development process.
Ouch!

But things are changing. If you have a modern computer, an Android emulator created using Android Studio 3 should take less than a minute to first load. And it should run fast thanks to virtualization technology such as HAXM from Intel on macOS and Windows and KVM on Linux.

The developers at Google have decided to go even further and introduced a new and powerful feature called Quick Boot. Once enabled, when you initiate an AVD for the first time, a cold boot will occur (like powering on a device), but all other times the previous state will be restored (like waking your phone), unless you manually ask for a cold boot.

You’ll need Android Emulator 27.0.2 or greater to use Quick Boot.

Android Emulator Version

New AVD’s you create will use Quick Boot by default. To use this feature on an existing AVD, go to your AVD’s configuration (the pencil icon):
AVD configuration

Click Show Advanced Settings:
Show Advanced Settings

Scroll down to Emulated Performance and make sure that Quick Boot is checked.
Quick Boot option

Start your virtual device and select More in the left menu:
AVD menu

Go to the Settings menu and select Yes on Save quick-boot state on exit:
Save quick-boot state

And that’s it!

Every time you close your emulator the state will be saved.
Saving emulator state

And when you start your emulator again, the previous session will be restored:
Restoring emulator state