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 is a huge platform with more than 2.5 billion monthly active devices. Though developers can use other IDEs to develop on Android, the latest features appear first in Android Studio. Google had released Android Studio 3.5 last year in February with very few new features, rather focusing completely on performance improvements and stability, which was known as Project Marble. Android Studio 4.0, on the other hand, includes a massive wave of new features. This version number 4.0 is suggested to be a major launch for anyone who develops apps and games for Android.
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.
Below you will see Android Studio 4.0 features categorised by design, develop, and build. The latest version also includes the usual performance enhancements and bug fixes on top of the latest features.
Android Studio 4.0 Features
- Motion Editor
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 onlyissue with this is that one would have to build the transitions in XML by themselves. Android Studio 4.0 brings with it a new Motion Editor interface that allows to build and edit transitions visually in a MotionLayout. Although it all ends up in an XML file only, one would not be required to write it out by themselves.
- Upgraded Layout Inspector
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.
- Layout Validation
Creating the layouts is undoubtedly one of the most difficult aspects of designing an app. With the help of built-in preview in Android Studio, one might create a layout, but it is going to appear terrible on your actual phone or tablet. Though, switching among various screen sizes and resolutions in the preview is still possible, it can prove to a hassle.
But no more worries over this now as you have got to be lucky this time. Android Studio 4.0 includes a Layout Validation view, which allows to see how the layout will appear on a variety of different screen sizes and resolutions, all at once.
Develop and Profile Features:
- CPU Profiler UI Upgrades
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 which 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.
- Smart Editor Features
R8 was introduced in Android Gradle plugin 3.4.0 to combine shrinking, desurging, optimizing, obfuscating, and dexing – leading to noticeable build performance enhancements. When creating R8 rules files, now Android Studio offers smart editor features, like syntax highlighting, completion, and error checking. The editor integrates with your Android project as well so as to provide full symbol completion for all methods, classes, and fields, and also includes refactoring and quick navigation.
- IntelliJ IDEA 2019.3 platform update
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.
- Live Template Update
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 Support for C++
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.
- Build Analyzer
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.
- Java 8 Language Support Update
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 can now use standard language APIs, which earlier were available only in recent Android releases like java.time, java.util.function and java.util.stream.
- Feature-on-Feature Dependencies
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.
- BuildFeatures DSL
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.
- Kotlin DSL
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 Plugon, 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.
One can easily download Android Studio 4.0 for Chrome OS, Mac, Widows, and Linux directly from the Android Developers site or can simply update your existing installation from within the app.
Considering all the new tools and updates Android Studio 4.0 provides, this might prove to be a golden opportunity for aspiring mobile app developers to get their hands on interesting mobile app development. With more than 12 years of experience in mobile app development, we have expertise in building apps for various platforms. If you are looking for some guidance for your project, connect with us over email. Be assured that our team will reach out to you very shortly with the right solution.