Android Studio 4.1 released with better machine learning support with support for TensorFlow Lite models in Android projects

android - Android Studio 4.1 released with better machine learning support with support for TensorFlow Lite models in Android projects

The team behind Google's Android Studio IDE development has released the stable version of Android Studio 4.1 Some highlights of Android Studio 4.1 include a new Database Inspector to query your app's database. , support for browsing projects that use Dagger or Hilt for dependency injection, and better support for on-device machine learning with support for TensorFlow Lite models in Android projects. The team also updated the application of changes to speed up deployment. Based on feedback from developers, she made several changes to provide game developers with a new native memory profiler and standalone profiling tools.


Material Design Components Updates

Android Studio models of the dialog box Create a new project now use Material Design Components (MDC) and follow updated instructions for default themes and styles. These changes will make it easier to use the recommended material style templates and support modern user interface features such as dark themes.

Updates include:

  • MDC: projects depend on material in build.gradle. Basic application themes use parents Theme.MaterialComponents. * and replace the updated MDC color and on attributes.
  • Color resources: color resources in colors.xml use literal names (for example, purple_500 instead of colorPrimary).
  • Theme Resources: theme resources are in themes.xml (instead of styles.xml) and use names Theme..
  • Dark theme: basic application themes use parents DayNight and are divided between res / values and res / values-night.
  • Theme attributes: color resources are referred to as topic attributes (for example, ? attr / colorPrimary) in layouts and styles to avoid hard coded colors.


Database inspector

The team wanted to make it easier to inspect, query, and modify databases in developer applications using the new Database Inspector. To get started, deploy your application on a device running APIs at least level 26 and select View> Windows Tool> Database Inspector from the menu bar. Whether your application uses the Jetpack Room library directly or the Android platform version of SQLite, you can now easily inspect the databases and tables of your running application or perform custom queries.

Since Android Studio maintains a live connection while you inspect your app, you can also edit the values ​​using the Database Inspector and see those changes in your running app. If you are using the Room persistence library, Android Studio also places execute buttons next to each query in the Code Editor to help you quickly execute the queries you define in your @Query annotations.

Run the Android emulator directly in Android Studio

You can now run the Android emulator directly in Android Studio. Use this feature to conserve screen surface, to quickly navigate between the emulator and the editor window using keyboard shortcuts, and to organize your EDI and mulator workflow in a single application window. You can manage snapshots and common emulator actions such as rotating and taking screenshots from Android Studio, but accessing the full set of options still requires running the emulator. stable. You can choose to use this feature by going to File → Settings → Tools → emulator → Launch in the tool window.

a - Android Studio 4.1 released with better machine learning support with support for TensorFlow Lite models in Android projects

Dagger navigation support

Dagger is a popular library for dependency injection on Android. Android Studio makes it easier to navigate your li Dagger code by providing new actions and extending support in the Find Uses window.

Use TensorFlow Lite models

Android developers use machine learning to create innovative and useful experiences. TensorFlow Lite is a popular library for writing mobile machine learning models, and the team wanted to make it easy to import these models into Android apps. Similar to view binding, Android Studio generates easy-to-use classes so that you can run your model with less code and better type security. The current implementation of ML Model Binding supports image classification and style transfer models, provided they are enhanced with metadata.

To view the details of an imported template and get instructions on how to use it in your application, double-click the template file .tflite in your project to open the template viewer page.

Build and tests

Android mulator – Foldable hinge support

In addition to the recent addition of support for 5G cellular testing, the team added support for foldable devices in the Android emulator. As of Android 30.0.26 emulator, you can configure foldable devices with a variety of designs and folding configurations. When a foldable device is configured, the emulator publishes hinge angle sensor updates and posture changes, so you can test how your app responds to these devices.

a - Android Studio 4.1 released with better machine learning support with support for TensorFlow Lite models in Android projects

Export C / C ++ dependencies from AARs

Android Gradle Plugin 4.0 added the ability to import Prefab packages into AAR dependencies. The team wanted to extend the capability of this feature to also support native library sharing. AGP version 4.1 allows you to export libraries from your native external version into an AAR (Android Archive) for an Android library project. To export your native libraries, add the following to the Android block of your library project's build.gradle file:


buildFeatures {
    prefabPublishing true
prefab {
    mylibrary {
      headers "src/main/cpp/mylibrary/include"
    myotherlibrary {
        headers "src/main/cpp/myotherlibrary/include"

Other features of Android Studio 4.1 include:

  • The symbolization of native crash reports.
  • Updates to apply changes that allow faster builds.
  • Android Studio memory profiler now includes a native memory profiler for applications deployed on physical devices running Android 10 or later. The Native Memory Profiler tracks object allocations and dallocations in native code for a specific period of time and provides information about the total allocations and the remaining heap size.
  • C / C ++ dependencies can be exported from AAR (Android Archive) files.
  • Android Studio profilers are accessible in a separate window from the main Android Studio window, which is useful for game developers.
  • System Trace user interface improvements.
  • 2,370 bugs were fixed and 275 public issues were resolved.

fleche - Android Studio 4.1 released with better machine learning support with support for TensorFlow Lite models in Android projectsDownload Android Studio 4.1

Source: Android Studio

Categories Tech

Leave a Comment