Android Developers Blog
The latest Android and Google Play news for app and game developers.
🔍
Platform Android Studio Google Play Jetpack Kotlin Docs News

04 mayo 2021

Android Studio 4.2


Link copied to clipboard

Posted by Jamal Eason, Product Manager, Android

Android logo

We are excited to announce that Android Studio 4.2 is now available to download in the stable release channel. The focus areas for this release is an upgraded IntelliJ platform and a handful of new features centered around improving your productivity as an Android app developer.

We know sometimes upgrading your app project to the latest version can be complicated. To address this, we have a new app project upgrade assistant in Android Studio 4.2 that makes it easier to migrate your project and to take advantage of the latest Android Gradle Plugin APIs. Additionally, we have added a whole range of enhancements to the existing features like the Database Inspector, System Trace, SafeArgs support, Apply Changes, the new project wizard and more. If you use these features and you are looking for the next stable version of Android Studio, you should download Android Studio 4.2 today!

Check out the list of new features in Android Studio 4.2 below, organized by key developer flows.

Develop

  • IntelliJ Platform Update - Android Studio 4.2 includes all the major features and updates found in IntelliJ IDEA Community Edition 2020.2, which includes an updated GitHub UI for pull requests, and new centralized problems window, and more. Learn more.
  • Safe Args Support - Using Safe Args is the recommended way to ensure data encapsulation if you want to pass data between two destinations in your app when you are using the Jetpack Navigation component. With Android Studio 4.2, you now have code autocompletion for Directions Args, and code navigation from source to XML. Learn more.
    safe arfs support

    Safe Args Support

  • New Project Wizard and Module Wizard Updates - This release includes a visual refresh to the new project wizard to make it easier to discover Android device types, plus we added ViewBinding to each of the templates as well. Furthermore, we also made a visual update to the new module wizards to make it easier to understand the variety of module types you can add to your app.
New Project Wizard  New Module Wizard

New Project Wizard & New Module Wizard

Debug

  • Database Inspector Improvements - Managing and monitoring your in app database is easier to do with the Database Inspector. In this release we made a couple new enhancements. We added a new offline mode, so that you can still keep inspecting your app's databases after a process disconnects, making it easier to diagnose your app after a crash. And we added a handy query history option as well.
Query History with the Database Inspector

Query History with the Database Inspector

  • Retrace Command Line Tool - As part of your app compilation process, R8 obfuscates Kotlin and Java programming language code. This can make stack traces impossible to decipher since types and method names are obfuscated and shortened to reduce the memory footprint of your app. The Retrace command line tool deobfuscates these names and recovers inlined frames using a mapping.txt file, making stack traces understandable again The new standalone tool can be found at ./sdk/cmdline-tools/latest/bin/retrace. Learn more.

Build

  • AGP Upgrade Assistant - Migrating your project to the latest Android Gradle Plugin (AGP) can sometimes be tricky especially if you use deprecated APIs. To solve this and to better prepare you for the transition to the Android Gradle Plugin 7.0, we created a new upgrade assistant. The assistant allows you to toggle the commands that will be executed on your project to upgrade to a higher version of AGP, preview exactly which files will be affected by the AGP upgrade, and lastly globally update deprecated configurations.
AGP Upgrade Assistant<

AGP Upgrade Assistant

  • Apply Changes Enhancements - Apply Changes lets you push code and resource changes to your running app without restarting your app. In Android Studio 4.2 we have expanded the number of compatible changes with Apply Changes to include adding resources (which accounted for 23% of changes that needed a full restart) and adding static final fields (e.g. constants) when running on an Android 11+ device or emulator.
  • Android Gradle Plugin 4.2 - With AGP 4.2, we made a number of notable changes. First, we implemented a new resources compiler which should aid in improving build performance especially on Windows machines. Secondly, we have updated the default Java programming language to version 8. Lastly, we added support for the APK v3 and APK v4 signing format. Learn more about additional AGP updates here.
// build.gradle.kts

android {
   ...
   signingConfigs {
      config {
          ...
          enableV3Signing(true)
          enableV4Signing(true)
      }
   }
}

APK v3 and APK v4 singing support

Test

  • Multiple Device Deployment - Sometimes when you are developing and testing your app it is helpful to deploy your app on multiple devices to see the results. We brought back this feature from very early versions of Android Studio and integrated it directly into the device selection menu in Android Studio 4.2. To note, if you deploy tests to multiple devices you may be prompted to enable this behavior.
Multiple Device Deployment

Multiple Device Deployment

Profile

  • System Trace Improvements - To understand the fine-grained performance characteristics of your app, it helps to use the system trace features inside of the Android Studio profiers. With this release of Android Studio, system trace now has a new events table. With this new table view you can see; BufferQueue, RSS memory counters, and CPU core frequency all within a compact user interface. Profiler with new System Trace Events Table

    Profiler with new System Trace Events Table

    To recap, Android Studio 4.2 includes these new enhancements & features:

    Develop

    • IntelliJ 2020.2.3 Platform Update
    • Safe Args Support
    • New Project Wizard and Module Wizard Updates

    Debug

    • Database Inspector Improvements
    • Retrace Command Line Tool

    Build

    • AGP Upgrade Assistant
    • Apply Changes Enhancements
    • Android Gradle Plugin 4.2

    Test

    • Multiple Device Deployment

    Profile

    • System Trace Improvements

    Check out the Android Studio release notes, Android Gradle plugin release notes, and the Android Emulator release notes for more details.


Getting Started

Download

Download the latest version of Android Studio 4.2 from the download page. If you are using a previous release of Android Studio, you can simply update to the latest version of Android Studio. If you want to maintain a stable version of Android Studio, you can run the stable release version and canary release versions of Android Studio Arctic Fox at the same time. Learn more.

We appreciate any feedback on things you like, and issues or features you would like to see. If you find a bug or issue, feel free to file an issue. Follow us -- the Android Studio development team ‐ on Twitter and on Medium.

Java is a registered trademark of Oracle and/or its affiliates.