Android Studio 4.1 (August 2020)

   日期:2024-12-26    作者:zedh6 移动:http://3jjewl.riyuangf.com/mobile/quote/55992.html

Android Studio 4.1 is a major release that includes a variety of new features and improvements.

Inspect, query, and modify your databases in your running app using the new Database Inspector. To get started, deploy your app to a device running API Level 26 or higher, and select View > Tool Windows > Database Inspector from the menu bar.

To learn more, see Debug your database with the Database Inspector.

You can now run the Android Emulator directly in Android Studio. Use this feature to conserve screen real estate, to navigate quickly between the emulator and the editor window using hotkeys, and to organize your IDE and emulator workflow in a single application window.

To learn more, see the Android Emulator documentation.

ML Model Binding makes it easy for you to directly import model files and use them in your projects. Android Studio generates easy-to-use classes so you can run your model with less code and better type safety.

The current implementation of ML Model Binding supports image classification and style transfer models, provided they are enhanced with metadata. Over time, support will be expanded to other problem domains, like object detection, image segmentation, and text classification.

A wide range of pre-trained models with metadata are provided on TensorFlow Hub. You can also add metadata to a TensorFlow Lite model yourself, as is outlined in Adding metadata to TensorFlow Lite model.

To import a supported model file, follow these steps:

  1. Open the TensorFlow Lite model import dialog in the File menu at File > New > Other > TensorFlow Lite Model.
  2. Select the model file that you previously downloaded or created.
  3. Click Finish.

This imports the model file into your project and places it in the folder; if the directory doesn't exist, Android Studio creates it for you.

To see the details for an imported model and get instructions on how to use it in your app, double-click the model file in your project to open the model viewer page, which shows the following:

  • Model: High-level description of the model
  • Tensors: Description of input and output tensors
  • Sample code: Example of how to interface with the model in your app

Here is an example using mobilenet_v1_0.25_160_quantized.tflite:

As the example demonstrates, Android Studio creates a class called for interacting with the model.

If the model does not have metadata, this screen will only provide minimal information.

  • Support for TensorFlow Lite models for problem domains other than image classification and style transfer is currently limited. Although import should work fine, some model inputs and/or outputs are represented by TensorBuffers rather than friendly types. For models without any metadata, all model inputs and outputs will be TensorBuffers.
  • Models with Input and Output data types different from or are not supported.

This feature is still under development, so please provide feedback or report bugs.

The Android Studio Memory Profiler now includes a Native Memory Profiler for apps deployed to physical devices running Android 10 or later. With the Native Memory Profiler, you can record memory allocations and deallocations from native code and inspect cumulative statistics about native objects.

To learn more about the Native Memory Profiler, see Inspect your app's memory usage with Memory Profiler.

The Native Memory Profiler in Android Studio 4.1 does not work for Android 11 devices. Support for profiling Android 11 devices is currently available in the 4.2 preview release".

As of the initial 4.1 release, app startup profiling has been disabled. This option will be enabled in an upcoming release.

As a workaround, you can use the Perfetto standalone command-line profiler to capture startup profiles.

The System Trace UI in the Android Studio profiler includes the following improvements:

  • Summary tab: The new Summary tab in the Analysis panel displays:

    • Aggregate statistics for all occurrences of a specific event, such as an occurrence count and min/max duration.

    • Trace event statistics for the selected occurrence.

    • Data about thread state distribution.

    • Longest-running occurrences of the selected trace event.

    To navigate to another occurrence, select another row from the table.

  • Display data: In the Display section, new timelines for SurfaceFlinger and VSYNC help you investigate rendering issues in your app's UI.

For basic usage instructions on how to record a system trace, see the Record traces section of Inspect CPU activity with CPU Profiler.

With the new standalone profilers, it's now possible to profile your app without running the full Android Studio IDE.

For instructions on using the standalone profilers, see Run standalone profilers.

Android Studio makes it easier to navigate between your Dagger-related code by providing new gutter actions and extending support in the Find Usages window.

  • Find Usages node: When you invoke Find Usages on a provider of a given type, the Find window now includes a Dependency consumer(s node that lists consumers of that type. Conversely, invoking this action on a consumer of a Dagger-injected dependency, the Find window shows you the provider of that dependency.

Android Studio templates in the Create New Project dialog now use and conform to updated guidance for themes and styles by default. Updates include:

  • MDC: Projects depend on in . Base app themes use parents and override updated MDC color and “on” attributes.

  • Color resources: Color resources in use literal names (for example, instead of ).

  • Theme resources: Theme resources are in (instead of ) and use names.

  • Dark theme: Base application themes use parents and are split between and .

  • Theme attributes: Color resources are referenced as theme attributes (for example, ) in layouts and styles to avoid hard-coded colors.

The core Android Studio IDE has been updated with improvements from IntelliJ IDEA through the 2020.1 release, including a new Commit window that enables version control operations and a new Zen mode that can be toggled by selecting View > Appearance > Enter Distraction Free Mode.

To learn more about the improvements in version 2020.1, see .

The locations of user configuration directories have been changed to the following:

Syntax:

Example:

Syntax:

Example:

Syntax:

Example:

These new directory locations are consistent with recent updates to IntelliJ IDEA, the IDE on which Android Studio is based.

If Studio doesn't restart after an upgrade, you may need to delete the configuration directory from a previous Studio version. See the known issues page for more information.

Android Studio 4.1 bundles Kotlin 1.3.72, which includes a number of fixes to improve Kotlin highlighting, inspections, and code completion. Check out the 1.3.72 Kotlin changelog for details.

When creating a custom view (for example, by extending the or class), Android Studio now shows you a preview of your custom view. Use the dropdown menu in the toolbar to switch between multiple custom views, or click the buttons to wrap vertically or horizontally to the content.

When a crash or ANR occurs in native code, the system produces a stack trace, which is a snapshot of the sequence of nested functions called in your program up to the moment it crashed. These snapshots can help you to identify and fix any problems in the source, but they must first be symbolicated to translate the machine addresses back into human-readable function names.

If your app or game is developed using native code, like C++, you can now upload debug symbols files to the Play Console for each version of your app. The Play Console uses these debug symbols files to symbolicate your app's stack traces, making it easier to analyze crashes and ANRs. To learn how to upload debug symbols files, see Native crash support.

To help you be more productive as you iterate on your app, we've made the following enhancements to Apply Changes for devices running Android 11 Developer Preview 3 or higher:

To learn more about the difference between these two actions, see Apply Changes.


特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


举报收藏 0评论 0
0相关评论
相关最新动态
推荐最新动态
点击排行
{
网站首页  |  关于我们  |  联系方式  |  使用协议  |  隐私政策  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报  |  鄂ICP备2020018471号