Google has launched the latest version of its IDE (Integrated Development Environment), Android Studio 4.0 in May 2020. This release is supposed to help app developers code smarter, build faster, and design apps’.
Android has a large user base of more than 2.5 billion monthly active devices. Though Android app development is available in additional IDEs, the newest features appear first in Android Studio. Google released Android Studio 3.5 last year in February, shortly after Project Marble ended, which concentrated on performance improvements and stability rather than introducing many new capabilities. The release of Android Studio 4.0 includes a substantial increase in new features. Anyone who creates apps or games for Android should consider this version number 4.0 to be a major debut.
The most interesting features that developers would find in the latest version are new tools to help in designing the apps. It includes a new Motion Editor, a Build Analyzer, and Java 8 language APIs. Google also revamped the CPU Profiler user interface and enhanced the Layout Inspector.
The new Motion Editor lets you build complex MotionLayout animations with the help of a simple click-and-drag interface, while earlier this required editing XML files manually. In the meantime, the Layout Inspector and Layout Validation tools allow you to preview the design of your app in 3D or across multiple screen sizes.
Android Studio 4.0’s features are organized into three categories: design, development, and building. On top of the most recent capabilities, the most recent version also includes standard performance improvements and bug fixes.
For almost a couple of years now, AndroidX has had a subclass of ConstraintLayout known as MotionLayout. The purpose of MotionLayout is to help animate between layout states more easily.
The main disadvantage with this approach is that one must construct the transitions in XML. Android Studio 4.0 includes a new Motion Edit user interface that allows you to make and modify motion transitions visually within a MotionLayout. Although it all ends up in an XML file, one does not have to write it oneself.
This one is a very useful tool that Android Studio has had for a while now. The Layout Inspector lets you see on debuggable apps exactly how your app is laid out on-screen, besides their various attributes. The New and Enhanced Layout Inspector in Android Studio 4.0 expands on the old version.
Though one can still use it for simple view-tree inspection, it now has features such as live refreshing. Paired with devices that are running at least Android 10, there are even more new features such as a 3D representation of what’s on-screen and more detailed View attributes.
The creation of layouts is without a doubt one of the most challenging elements of building an app. One may create a layout in Android Studio’s built-in preview, but it will appear terrible on your real phone or tablet. Switching among multiple screen sizes and resolutions while previewing, on the other hand, is still possible; however, it can be time-consuming.
However, there’s no need to be concerned about this any longer, because you’ve stumbled upon something good. Android Studio 4.0 includes a Layout Validation view that shows how the layout will appear on a range of screen sizes and resolutions across all devices simultaneously.
The CPU profiler is designed to offer a rich amount of information about the thread activity and trace recordings of your app. Now, the CPU recordings are separated from the main profiler timeline and have been organized in groups. For additional customizations, one can drag and drop individual items within a group or can even move the entire group up and down. There’s a Thread Activity timeline that includes methods, functions, and events.
Here one can view all thread activity and can also try navigation shortcuts to move around the data easily like using W, A, S, and D keys for fine-grained zooming and panning.
In Android Gradle plugin 3.4, the R8 compiler was added to assist with shrinking, resurging, optimizing, obfuscating, and dexing – resulting in significant build speed improvements. When creating R8 rule files in Android Studio now has smart editor functions such as syntax highlighting, completions, and error checking. The editor ties into your Android project to offer comprehensive symbol completion for all methods, classes, and fields as well as refactoring and fast navigation.
The core Android Studio IDE has been updated with enhancements from IntelliJ IDEA 2019.3 and 2019.3.3 releases. These updates focus majorly on quality and performance enhancements across the IDE.
An IntelliJ feature lets you insert common constructs into the code by typing simple keywords. Android Studio 4.0 includes Android-specific live templates for your Kotlin code. For a complete list of available live templates, navigate to Editor > Live Templates in the Preferences or Settings dialog.
Clangd is the primary language analysis engine for developers writing C++ for code navigation, completion, inspection, and showing code errors as well as warnings. Google also bundles clang-tidy now with Android Studio.
Misconfigured or outdated tasks can lead to longer build times resulting in lost productivity and frustration. The Build Analyzer helps the developers to understand and address blockage in your build by highlighting the tasks and plugins that are most responsible for the overall build time and also suggests steps to mitigate regressions.
Earlier versions of the Android Gradle plugin supported a wide variety of Java 8 language features for all API levels like lambda expressions and method references, via a process known as desugaring. In Android Studio 4.0 version, the desugaring engine has been extended to support Java language APIs, irrespective of your app’s minSdkVersion.
This implies that you may now utilize standard programming APIs that were previously available only in more recent Android versions, such as java.time, java.util.function, and java.util.stream.
One can now specify a Dynamic Feature module depending on another feature module. Being able to define this relationship means that your app has the needed modules to unlock additional functionality leading to fewer requests as well as easier modularization of your app.
The Android Gradle plugin includes built-in support for modern libraries like view binding and data binding, and build features, like auto-generated BuildConfig classes. However, one might not require these features and libraries for every project. One can now easily disable discrete build features, which can help to optimize build performance for bigger projects.
Built-in support for Kotlin DSL build script files implies that Kotlin build scripts provide a full suite of quick fixes and are also supported by the Project Structure dialog. Throughout the next year, Google will continue to refine the DSL API of the Android Gradle Plugin, which might lead to breaking API changes for Kotlin script users. In the longer run, these fixes will make for a more easy-to-use, idiomatic DSL for Kotlin script users.
In the end, Android Gradle plugin 4.0.0 includes support for Build Analyzer of Android Studio by using Java 8 language APIs, irrespective of the minimum API level of your app, and building feature-on-feature dependencies between Dynamic Feature modules.
You may download Android Studio 4.0 for Chrome OS, Mac, Windows, and Linux from the Android Developers site or simply upgrade your current installation from within the app.
Given all of Android Studio 4.0’s tools and updates, this may well be a golden opportunity for aspiring mobile app developers to get their hands on intriguing development. We have expertise in developing apps for a variety of platforms after more than 12 years of experience in mobile app development. Looking for some expert solutions for your project? Connect with our team of specialists today.
About the Author