1
头图

Author/Android Product Manager Jamal Eason

We are happy to announce that Android Studio 4.2 is now released and can be downloaded from the stable release channel. The focus of this version is to launch an upgraded IntelliJ platform and some new features, which are designed to improve the efficiency of Android application developers.

We know that sometimes it is not easy to upgrade an application project to the latest version. In order to solve this problem, we provide a new application project upgrade assistant in Android Studio 4.2, which makes it easier to migrate projects and use the latest Android Gradle plug-in API. In addition, we have also made a series of optimizations to existing functions (such as Database Inspector [Database Inspector], System Trace, SafeArgs support, Apply Changes, new project wizard, etc.). If you are using these features and are looking for the next stable version of Android Studio, then you can download Android Studio 4.2 now!

Please click here view the video introducing the new features in Android Studio 4.2 in turn according to the main developer process.

Development

  • IntelliJ platform update -Android Studio 4.2 contains all the main features and updates in IntelliJ IDEA Community Edition 2020.2, including the new version of the GitHub PR interface and a new centralized problem feedback window. click here for more details.
  • Safe Args supports -If you want to transfer data between two target locations in the application when using Jetpack navigation components, it is recommended to use Safe Args to ensure data encapsulation. By using Android Studio 4.2, you can now automatically complete the code of Directions Args and implement code navigation from source to XML. Click here for more details.

△ Safe Args support
  • new project wizard and module wizard update -In this version, in order to make it easier to discover Android device types, we have made a new design for the visual effects of the new project wizard, and also added ViewBinding to each template. In addition, we have also updated the visual effects of the new module wizard to make it easier for you to understand the various types of modules that can be added to the application.

△ New project wizard and new module wizard

debug

  • Database Inspector (Database Inspector) Improved -Through the Database Inspector, you can more easily manage and monitor your in-app database. In this version, we have made some new optimizations. An offline mode has been added so that you can keep checking the application database after the process is interrupted, making it easier to diagnose the application after it crashes. At the same time, we also added a convenient query history option.

△ Use Database Inspector to query historical records
  • Retrace command line tool -As part of the application compilation process, R8 will confuse Kotlin and Java programming language code. In order to reduce the memory footprint of the application, it confuses and shortens the type and method names so that the stack trace cannot be decoded. The Retrace command line tool will de-obfuscate these names and use the mapping.txt file to restore the inline frame to make the stack trace easy to understand again. You can go to ./sdk/cmdline-tools/latest/bin/retrace to find this new standalone tool. Click here for more details.

build

  • AGP Upgrade Assistant -Migrating projects to the latest version of the Android Gradle Plugin (AGP) can sometimes be tricky, especially when using deprecated APIs. In order to solve this problem and to Android Gradle plugin 7.0 , we have developed a new upgrade assistant. With the help of this assistant, you can switch the commands executed for the project to upgrade to a higher version of AGP, preview the files that will be affected by the AGP upgrade, and finally make a global update to the deprecated configuration.

△ AGP Upgrade Assistant
  • Apply Changes Enhanced -You can use Apply Changes to push code and resource changes to the running application without restarting the application. In Android Studio 4.2, we have extended a large number of changes compatible with Apply Changes. When running on devices or emulators with Android 11 or above, we can add resources (23% of the changes that require a full restart) and add Static final fields (such as constants).
  • Android Gradle Plugin 4.2 -We have made many significant changes with AGP 4.2. First, we implemented a brand new resource compiler to improve build performance, especially on Windows devices. Second, we have updated the default Java programming language to version 8. Finally, we APK v3 and APK v4 signature formats. You can check related documents learn more about other AGP updates.
// build.gradle.kts

android {
   ...
   signingConfigs {
      config {
          ...
          enableV3Signing(true)
          enableV4Signing(true)
      }
   }
}
△ APK v3 and APK v4 signature support

test

  • Multi-device deployment -When developing and testing applications, multi-device deployment can sometimes help you deploy the application to multiple devices to view the results. This feature was a feature in earlier Android Studio versions, and now we have introduced it again and integrated it directly into the device selection menu in Android Studio 4.2. It’s important to note that if you deploy tests to multiple devices, you may be prompted to enable this behavior.

△ Multi-device deployment

performance analysis

  • System Trace Improvement -In order to understand the detailed performance characteristics of the application, you can use this improvement to use the System Trace function inside the Android Studio performance profiler. In this version of Android Studio, we have now launched a brand new event table for system trace. Through this brand-new table view, you can view BufferQueue, RSS memory counter and CPU core frequency in one compact user interface.

△ Performance profiler using the new System Trace event table

A brief review, Android Studio 4.2 includes the following new optimizations and features:

Development

  • IntelliJ 2020.2.3 platform update
  • Safe Args support
  • New project wizard and module wizard update

debug

  • Database Inspector improvements
  • Retrace command line tool

build

  • AGP Upgrade Assistant
  • Apply Changes optimization
  • Android Gradle plugin 4.2

test

  • Multi-device deployment

performance analysis

  • System Trace improvements

For more detailed information, you can refer to Android Studio release notes , Android Gradle plugin release notes and Android emulator release notes .

Quick start

You can go to download the latest version of Android Studio 4.2 for If you are using a previous version of Android Studio, you only need to update to the latest version of Android Studio. If you want to keep the stable version of Android Studio, you can run both the stable version of Android Studio Arctic Fox and the Canary version at the same time. click here for more details.

You are welcome to provide feedback, share what you like, problems you find, or ideas about features you want to see. If there are any errors or problems, please feel free to us submit questions . You are also welcome to continue to pay attention to us and keep abreast of the latest developments.

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


Android开发者
404 声望2k 粉丝

Android 最新开发技术更新,包括 Kotlin、Android Studio、Jetpack 和 Android 最新系统技术特性分享。更多内容,请关注 官方 Android 开发者文档。