Missed the GamesBeat Summit excitement? Don't worry! Tune in now to catch all of the live and virtual sessions here.
Google today launched Android Studio 4.1, the latest version of its integrated development environment (IDE). Android Studio 4.1 is supposed to address “common editing, debugging, and optimization use cases.” Version 4.1 includes easier implementation of on-device TensorFlow Lite models, the ability to run Android Emulator directly in the IDE, and support for foldable form factors. There’s also a new Database Inspector for querying your app’s database, support for navigating projects that use Dagger for dependency injection, and updates to Apply Changes for faster builds. Additionally, Android Studio 4.1 fixes 2,370 bugs and closes 275 public issues.
Android is a massive platform with over 2.5 billion monthly active devices. While developers can use other IDEs to build on Android, the latest features arrive first in Android Studio. You can now download Android Studio 4.1 for Windows, Mac, and Linux directly from developer.android.com/studio. If you are already using Android Studio, you can get the latest version in the navigation menu (Help => Check for Update on Windows/Linux and Android Studio => Check for Updates on OS X).
Android Studio 4.1 comes a month after Google launched Android 11. While version “4.1” indicates this a minor release (Google released Android Studio 4.0 in May), it’s important for anyone who builds apps and games for Android. Below are the new Android Studio 4.1 features broken down by category: design, develop, build, and optimize (full release notes).
Android Studio 4.1 design features
Android Studio templates in the create New Project dialog now use Material Design Components (MDC). The templates also now conform to updated guidance for themes and styles by default:
Join us in San Francisco on July 11-12, where top executives will share how they have integrated and optimized AI investments for success and avoided common pitfalls.
- MDC: Projects depend on
build.gradle. Base app themes use
Theme.MaterialComponents.*parents and override updated MDC color and “on” attributes.
- Color resources: Color resources in colors.xml use literal names (for example, purple_500 instead of
- Theme resources: Theme resources are in themes.xml (instead of styles.xml) and use Theme. names.
- Dark theme: Base application themes use DayNight parents and are split between res/values and res/values-night.
- Theme attributes: Color resources are referenced as theme attributes (for example, ?attr/colorPrimary) in layouts and styles to avoid hard-coded colors.
Android Studio 4.1 develop features
- Database Inspector: Inspect, query, and modify your app’s databases. 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. Whether your app uses the Jetpack Room library or the Android platform version of SQLite directly, you can now inspect databases and tables in your running app or run custom queries. Because Android Studio maintains a live connection while you’re inspecting your app, you can also modify values using the Database Inspector and see those changes in your running app. If you use the Room persistence library, Android Studio also places run buttons next to each query in the code editor to help you quickly run queries you define in your @Query annotations.
- Run 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. You can manage snapshots and common emulator actions like rotating and taking screenshots from within Studio, but access to the full set of options still requires running the stable emulator. You can opt-in to use this feature by going to File => Settings => Tools => Emulator => Launch in Tool Window.
- Dagger Navigation Support: Navigate between your Dagger-related code via new gutter actions and the Find Usages window. For example, clicking on the gutter action next to a method that consumes a given type navigates you to the provider of that type. Conversely, clicking on the gutter action navigates you to where a type is used as a dependency.
- Use TensorFlow Lite models: Similar to view binding, Android Studio generates easy-to-use classes so you can run your machine learning 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. To see the details for an imported model and get instructions on how to use it in your app, double-click the .tflite model file in your project to open the model viewer page.
Android Studio 4.1 build features
- Android Emulator — Foldable Hinge Support: With Android emulator 30.0.26 and above, you can configure foldable devices with a variety of fold designs and configurations. When a foldable device is configured, the emulator will publish hinge angle sensor updates and posture changes, so you can test how your app responds to these form factors.
- Apply Changes updates: For devices running Android 11 or higher, you can deploy and persist changes on a device without installing the application. After an initial deploy, subsequent deploys to Android 11 devices using either Apply Code Changes or Apply Changes and Restart Activity are now significantly faster. Also, now if you add a method, you can deploy those changes to a running app by clicking either Apply Code Changes or Apply Changes and Restart Activity.
- Export C/C++ dependencies from AARs: Android Gradle Plugin 4.0 added the ability to import Prefab packages in AAR dependencies. This feature now supports sharing native libraries as well. AGP version 4.1 enables exporting libraries from your external native build in an AAR for an Android Library project.
- Symbolication for native crash reports: 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.
Android Studio 4.1 optimize features
- System Trace UI improvements: System Trace, an optimization tool that gives you a real-time look at how your app is using system resources, has been overhauled. It features a box selection mode, a new analysis tab, and more frame rendering data.
- Standalone profilers: It’s now possible to access the Android Studio Profilers in a separate window from the primary Android Studio window. This is useful when optimizing Android games built with other tools like Unity or Visual Studio.
- Native Memory Profiler: The Android Studio Memory Profiler now includes a Native Memory Profiler for apps deployed to physical devices running Android 10 or later. The Native Memory Profiler tracks allocations/deallocations of objects in native code for a specific time period and provides information about total allocations and remaining system heap size.
GamesBeat's creed when covering the game industry is "where passion meets business." What does this mean? We want to tell you how the news matters to you -- not just as a decision-maker at a game studio, but also as a fan of games. Whether you read our articles, listen to our podcasts, or watch our videos, GamesBeat will help you learn about the industry and enjoy engaging with it. Discover our Briefings.