It seems like just yesterday (if yesterday was February) that Android Studio 3.6 was released with a bunch of useful additions and needed fixes. Now, a day (three months) later, Google has pushed Android Studio 4.0 to stable with even more useful additions and needed fixes. Read on to learn more about what’s new.
The first feature we’re going to talk about is the Motion Editor. For almost a couple of years now, AndroidX has had a subclass of ConstraintLayout called MotionLayout. MotionLayout’s purpose is to help you animate between layout states more easily. The only problem was that you would have to create the transitions in XML yourself. With Android Studio 4.0, there’s a new Motion Editor interface that lets you visually create and edit transitions and animations in a MotionLayout. It all ends up in an XML file anyway, but you no longer have to write it out yourself.
New Layout Inspector
A very useful tool that Android Studio has had for a while now is the Layout Inspector. On debuggable apps, it lets you see exactly how your app is laid out on-screen, along with their various attributes. In Android Studio 4.0, the New & Improved Layout Inspector expands on the old version. While you can still use it for simple view-tree inspection, it now includes features like live refreshing. Paired with devices running at least Android 10, you’ve got even more features, like more detailed View attributes and a 3D representation of what’s on-screen.
One of the more difficult aspects of designing an app is, arguably, creating the layouts. You might create a layout using the built-in preview in Android Studio, only to have it look terrible on your actual phone or tablet. While it’s possible to switch among different screen sizes and resolutions in the preview, it can be a hassle. If this is something that’s bothered you, you’re in luck! Android Studio 4.0 adds a Layout Validation view, which lets you see how your layout will look on a variety of different screen sizes and resolutions, all at once.
Java 8 Desugaring for all APIs
Another annoying part of developing for Android is trying to use Java 8 features. Maybe you found some code that implements a Stream or you want to use a lambda function. Maybe there’s even a Java 8 API that you need that just isn’t practical to work around. For a while now, the Android Gradle plugin has been able to compile some Java 8 features to older APIs, but starting with Android Studio 4.0, all Java 8 functionality should now be supported.
This list is far from exhaustive. These are just some of the more interesting additions in Android Studio 4.0. Here’s a summary of the major new enhancements and features introduced in the latest release, courtesy of Google:
Want more posts like this delivered to your inbox? Enter your email to be subscribed to our newsletter.