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.

Android Studio 4.0 changelog

Motion Editor

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.

Android Studio 4.0 new layout inspector

Layout Validation

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:

Android Studio 4.0 Changelog Overview

Design

  • Motion Editor: a simple interface for creating, editing, and previewing MotionLayout animations
  • Upgraded Layout Inspector: a real-time & more intuitive debugging experience
  • Layout Validation: compare your UI across multiple screen dimensions

Develop & Profile

  • CPU Profiler update: improvements to make the UI more intuitive to navigate and the data easier to understand
  • R8 rules update: smart editor features for your code shrinker rules, such as syntax highlighting, completion, and error checking
  • IntelliJ IDEA 2019.3 platform update with performance and quality improvements
  • Live Template update: Android-specific live templates for your Kotlin code
  • Clangd support: Clangd and Clang-Tidy turned on by default

Build

  • Build Analyzer: understand and address bottlenecks in your build
  • Java 8 language support update: APIs you can use regardless of your app’s minimum API level
  • Feature-on-feature dependencies: define dependencies between Dynamic Feature modules
  • buildFeatures DSL: enable or disable discrete build features, such as Data Binding
  • Kotlin DSL: essential support for Kotlin DSL script files

If you want to learn more about this update, be sure to check out Google's blog post and the release notes for the full details or watch the video embedded below for a visual overview.