Blog

Home / Blog

Android Studio 4.0 adds Build Analyzer and Motion Editor

Billy Yann
Deep learning and machine learning specialist, well-versed with experience in Cloud infrastructure, Block-chain technologies and Big Data solutions.
August 08, 2020


The latest version of the official IDE for Android mobile development, Android Studio 4.0, has now reached the stable channel stage. It had added update features capabilities such as a Build Analyzer as well as a new Motion Editor. Motion Editor feature is a visual design editor for the MotionLayout type. This editor facilitates easy use of the MotionLayout API to manage widget animation and motion in their applications. As a result, XML files are generated, which saves developers from this task. This latest add on also supports editing constraint sets, transitions, keyframes, and view. For designing large and complex Android views MotionLayout builds upon the capabilities of ConstraintLayout.

A Build Analyzer helps to understand the Java 8 language application protocol interfaces (APIs) and the cause of build-time bottlenecks. Google has released Android Studio 4.0 with features like the brand-new Build Analyzer, motion editor, and an upgraded Layout Inspector. Moreover, Android Studio 4.0 is a massive update to its IDE for mobile app development. Android Studio is based on the popular JetBrains IntelliJ IDEA. The version 4.0 of Android Studio uses IDEA 2019.3.3. JetBrains claims faster IDE startup, reduced memory consumption, better UI responsiveness as well as improved performance for this latest version. However, the startup time is still not great though, especially for the first run after switch-on since it takes over a minute on a well-specified PC.

The main supported languages in Android Studio 4.0 are Kotlin and Java. Kotlin is made open source under the Apache license. This language was developed by JetBrains. Kotlin, which was launched in 2011, targets the JVM (Java Virtual Machine). Language support in Android Studio 4.0 does not stop at Kotlin or Java. Instead, Devs can include C++ and C code to use the Android NDK (Native Development Kit). Furthermore, Devs can also install plugins for other languages including Dart.

New features: Motion Editor and Build

The motion editor is a big new feature in Android Studio 4.0. This feature which is nothing too ambitious is added just by moving a piece of text around the screen. Motion editor is based on a ConstraintLayout. The ConstraintLayout lets you position elements relative to other elements or layouts. The addition of ConstraintLayout to a project requires the addition of dependency on the ConstraintLayout library and declaring the maven.google.com repository in the Gradle file. Motion Editor which is an extension of the usual layout editor can be now found in Android Studio. On selecting the "Split" or "Design" view on an XML file that uses Motion Layout APIs, it automatically opens up.

Further, a souped-up Motion Editor is one of the most eye-catching upgrades of Android Studio 4.0. Moreover, Motion Editor is Android's interface for creating MotionLayout animations in apps. developers had to manually modify and create complex XML files to design their animations in previous versions of Android Studio. The new Motion Editor allows you to create complex animations through a simply click-and-drag interface by generating the XML files for you.

Building animation with the Motion Editor

Android Studio makes it easier to preview and create animations since it includes a visual design editor for the MotionLayout type. For the manipulation of elements from the MotionLayout library that serves as the foundation for animation in Android apps, the new Motion Editor provides a simple interface. Without Android Studio, altering and creating these elements requires manually editing constraints in XML resource files. However, with support for start and end states, transitions, timelines, and keyframes, the Motion Editor can generate this XML for you. One has to specify the exact version of a dependency library to use the Motion Editor. To know if beta6 is the latest version, one has to go to the repository index and do a search. Beta6 was indeed the latest at the time of writing.

Developers can now add a ConstraintLayout to a project and choose Convert to MotionLayout by right-clicking the layout. One can add further keyframes if needed and set different constraints for Start and End. Individuals can also add ConstraintSet elements for some special effects, including rotation, translation, scale, visibility, and alpha. Apart from these, one can also add CustomAttributes for other effects such as changing the color. Animation in Android is easier than before using the Motion Editor. A new Layout Validation tool is available today that previews a layout on multiple devices. Google's Pixel range is included in the Android Studio 4.0 by default, otherwise, it is a matter of adding one's previews specifying Android API, theme, orientation, and display size. Even though it is a handy feature, it does take up a lot of screen space. However, it is now possible to float windows in Android Studio, and is this feature is helpful for this kind of tool.

Moreover, Android Studio 4.0 has an upgraded Layout Inspector. This now includes the ability to drill down the hierarchy of views and layouts as well as a 3D view. The upgraded Layout Inspector has a similar purpose to element and CSS inspectors in web browsers. The purpose of it is to troubleshoot why one's display does not look as hoped or expected. Additionally, C++ developers benefit from smart editor features like error detection and code completion. For automatic formatting of C or C++ code, a utility called clang-tidy is also bundled. The new feature of Build Analyzer acts as a profiler for the build process, showing the time taken for each step. Apart from this, the tool can detect steps that do not support incremental builds, and that takes the most time.

Build Analyzer

The Build Analyzer window helps you diagnose the issues with your build process when using Android Studio 4.0 with Android Gradle plugin 4.0.0 or higher. Moreover, it helps to understand disabled optimizations as well as improperly configured tasks. The users could find it under the Build button as the last option. Even though developing for Android still has annoyances, Android Studio is free and of high quality. Some of the annoyances related to the development of Android are inherent to the problem of mobile development, due to targeting thousands of different devices running various versions of Android. The IDE gives an estimate of what percentage or number of devices will be able to run one's app. The newest, version 8.1 Oreo can be used if a developer wants to target over 50 percent of devices.

However, there are many pieces to Android Studio including the Gradle build system, the IDE itself, Maven repositories, a blend of XML, visual designers, and Java or Kotlin code for the actual project. Google's Flutter project that has a cross-platform aspect is easier to work with than a native Android application if one can work with Dart rather than Kotlin or Java. Android Studio is a complex system and can be hard to troubleshoot. Flutter can increase productivity for professionals as well as lower the barriers to entry for Android development.

Android 4.0

Changelog Overview of Android Studio 4.0

Build:

• Feature-on-feature dependencies like define dependencies between Feature and Dynamic

• Java 8 language support update

• Build Analyzer helps to understand and address bottlenecks in your build

• You can now use APIs regardless of your app's minimum API level

• Kotlin DSL: essential support for Kotlin DSL script files

• Build Features of DSL assist to disable or enable discrete build features, such as Data Binding

Design:

• Upgraded Layout Inspector

• Motion Editor: a simple interface for editing, previewing, and creating, MotionLayout animations

• More intuitive and a real-time & debugging experience

• Layout Validation that helps to compare your UI across multiple screen dimensions

Profile and Develop:

• R8 rules update that includes smart editor features for your code shrinker rules, such as error checking, completion, and syntax highlighting

• IntelliJ IDEA 2019.3 platform update with quality as well as performance improvements

• Clang-Tidy and Clangd turned on by default

• CPU Profiler update: the data is now easier to understand and improvements to make the UI more intuitive to navigate

• Live Template update that includes Android-specific live templates for your Kotlin code

With over 2.5 billion monthly active devices, Android is infamous as a massive platform. The latest features arrive first in Android Studio while developers can use other IDEs to build on Android. Version 4.0 of Android Studio includes Java 8 language APIs, Build Analyzer, and Motion Editor. Google also improved the Layout Inspector and overhauled the CPU Profiler user interface.

Misconfigured or outdated tasks can cause longer build times that lead to lost productivity and frustration. The Build Analyzer helps developers address and understand bottlenecks in your build by highlighting the tasks and plugins that are most responsible for your overall build time. Build Analyzer does this by suggesting steps to mitigate regressions.

To help Android developers manage widget animation and complex motion in their apps, the MotionLayout API extends the rich capabilities of ConstraintLayout. You no longer have to modify or create complex XML files. Instead, the Motion Editor generates them for you. The latest features arrive first in Android Studio while coders or developers can use other IDEs to build on Android. You can now download Android Studio 4.0 for Linux, Mac, and Windows directly from developer.android.com/studio. Misconfigured or outdated tasks can cause longer build times that lead to lost productivity and frustration. But, with new features of Android Studio 4.0 like Build Analyzer and Motion Editor, you can now disable discrete build features. Hence, these features help you to optimize build performance for larger projects.