Android O Preview: What Developers Need to Know
The Android O Developer Preview dropped recently and the internet went nuts! The Developer Preview SDKs brought along many new features.
It’s that time of the year when Android Developers like you and me need to keep up with what’s latest.
I usually refrain from writing about Developer Previews, until a stable release arrives. But it’s better we get to know what’s new now. Rather than coping with changes in the future. So transitioning our apps to Android O will be smooth when the time comes.
Trying Android O with Android Studio EAP
In this post, we’ll first see how to setup Android Studio Preview. We need this to try out the new Android O Developer Preview SDKs. This is the first release, so I’m going to stick to calling it Android O DP1.
Using Android O DP1 requires Android Studio 2.4 EAP (Early Access Preview). Don’t worry as I’ll walk you through that as well. We’ll install Android Studio EAP in parallel to your existing Android Studio. So nothing will get affected.
Next, we’ll install the Android O Preview SDKs. This includes the Preview SDKs itself, Support Libraries and a System Image.
I’ll be updating this post to be relevant to future Android O SDK releases.
Before setting up everything, let’s see what Android O has to offer.
Some of the biggest features in Android O are:
1. Picture-in-Picture (PIP) support for Android Mobile
PIP was first introduced in Android Nougat. It became famous by the floating video player in YouTube. Just add the attribute
android:supportsPictureInPicture attribute in your tag in AndroidManifest.xml.
But, back then it was limited to Android TV. With Android O, they’ve finally brought it to smartphones as well. Goodbye
2. Custom Font support
No need to use a library or write a custom View. Drop in your fonts to res/fonts folder. Then you can use them with a single attribute.
Finally we can start seeing apps with less of Roboto!
You can read the full tutorial on how to use custom font resources.
3. Autofill Framework
Users can save time filling out forms by using autofill in their devices
Long story short. Are you familiar with auto-filling forms in your web browsers? Remembering your passwords and credit card information to autofill it when required. That’s available on Android now. Sweet?
4. Notification Channels
Notifications are great. Every Android release made it better. But honestly, notifications are a spam-fest on our phones right now.
Notification Channels provide a unified system to help users manage notifications
In short, Notification Channels let you group your notification into broad categories. You can change the behavior of these broad notification categories in your settings.
Other little, but noteworthy changes
Adaptive icons can help you integrate better with device UI, which can display a variety of shapes across different device models.
Honestly, I don’t get the point of this feature. It started with Nougat wanting to make every icon round. But now this.
Developer docs suggest a good UX tip. To use an inline ProgressBar in an Activity, instead of this modal dialog. But, you can take it a step further by using a better Progress Indicator called Skeleton Screen.
Spreads the typography over the full width. You just need one line and you’re good to go.
No more padding top, bottom, left and right. Just paddingHorizontal and paddingVertical. Save yourself from writing two extra lines.
OpenJDK Features for Android O
Some of the newly added packages include
java.nio.file. You can read the complete Android O API differences report here.
Android O learns your preference and suggests relevant apps depending on what you’re sharing. For example, if you want to share a photo, Android might suggest social media apps.
Now we’re fully aware of what Android O has to offer. Time for us Android Developers to start preparing our apps for Android O.
How to Develop for Android O right now?
To access the preview, you must first update to Android Studio 2.4.
A word of caution:
Keep in mind, we’re using an unstable IDE. Moreover, the Android O SDKs are still Release Candidates. Which means it’s the very first preview for us to give it a try. Expect to find bugs and even crashes! So if you do, be a good samaritan and report them to Google.
Also, since it is unstable, be sure to update your SDKs and IDE as soon as an update is available.
The official Android developer documentation explains how to setup Android O. I highly recommend you follow their guide first. You can safely install Android Studio Preview in parallel to your existing, stable Android Studio.
In short, nothing gets affected. Android Studio EAP will safely use your existing SDK path. Just install the new preview SDKs, download a system image and you’re good to go.
But just in case, here’s a quick checklist of everything you need to do:
- Download and install Android Studio 2.4 Preview (EAP)
- Next, install Android O preview SDK
- Download a preview image for emulator (Google APIs Intel x86 Atom System Image)
- Download and install SDK Build-Tools 26-rc1
- Create a new project targeting Android O Preview
- Check app/build.gradle if correct targetSdkVersion and Support libraries are used
- Create a new AVD targeting Android O
- Test your app by running it on the new AVD
The setup might look exhausting. But trust me, it took hardly an hour to do all that.
Moreover, developer.android.com does a good job of walking you through. It is fairly simple. But, if you get stuck anywhere, feel free to drop a comment here or send me a Tweet. I’ll be happy to help.
With Android Studio EAP setup, and the new SDKs downloaded, you’re good to go.
You can compile and test your apps against Android O. Check if everything works smoothly. Also, you can use this time to make your apps take advantages of the new features. For example, expect the Autofill Framework and Notification Channels to be widely used.
Even if you don’t want to support Android O right now, it’s okay. You can test drive the new SDKs and see what it has to offer.
So what did you like about Android O DP1? My particular favorite is the new font support.
What’s your favorite feature? Did I miss anything? Tell me in the comments below.
Also, in the coming weeks I’ll be covering each of these features. So don’t forget to subscribe below.