Android Studio 4.2 enlists project upgrade assistant in bid to ease migration

Android Studio 4.2 enlists project upgrade assistant in bid to ease migration

Google has released Android Studio 4.2 with an upgraded IntelliJ platform, upgrade assistant, and features aimed at improving productivity for Android developers.

Announced on the Android Developers Blog, Android Studio 4.2 includes all the major features and updates found in the IntelliJ IDEA Community Edition 2020.2 release, which includes an updated GitHub user interface for pull requests, and new centralised problems window.

However, one of the more useful features for developers is likely to be the AGP Upgrade Assistant. This has been designed to help with migrating projects to the latest Android Gradle Plugin, which can be a tricky process if developers are still using deprecated APIs, according to Google. The Upgrade Assistant allows users to toggle the commands that will be executed on their project to upgrade to a higher version of AGP, preview which files will be affected by the AGP upgrade, and globally update deprecated configurations.

This release also features a visual refresh to the new project wizard to make it easier to discover Android device types, while Google has also added ViewBinding to each of the templates. A visual update has also been given to the new module wizards to make it easier for users to understand the variety of module types that can be added to apps.

On the debugging side, Android Studio 4.2 brings some improvements to the Database Inspector. These comprise a new offline mode, so that developers can keep inspecting their app databases after a process disconnects, making it easier to diagnose after a crash. Google has also added a query history option.

A Retrace command line tool allows developers to deobfuscate Kotlin and Java programming language code, which gets obfuscated as part of the app compilation process. It recovers inlined frames using a mapping.txt file, making stack traces understandable again. This new standalone tool can be found at ./sdk/cmdline-tools/latest/bin/retrace.

Android Studio 4.2 also expands the number of compatible changes that Apply Changes can apply to a running app without restarting it, to include adding resources and static final fields (e.g. constants) when running on an Android 11+ device or emulator.

For full details of all the changes in Android Studio 4.2, see the Android Studio release notes, Android Gradle plugin release notes, and the Android Emulator release notes.