Android Studio 3.2 Canary
Android Studio 3.2 Canary
from Android Developer
Today at Google I/O 2018 we announced the latest preview of Android Studio 3.2 which includes an exciting set of features that support the Android P Developer Preview , the new Android App Bundle , and Android Jetpack . Download Android Studio 3.2 from our canary release channel today to explore one of the most feature rich releases of the year.
Android Jetpack is a set of libraries, developer tools and architectural guidance to help make it quick and easy to build great Android apps. It provides common infrastructure code so you can focus on what makes your app unique. Android Studio 3.2 includes a wide set of tools that support Jetpack from a visual Navigation Editor that uses the Navigation API, templates for Android Slices APIs, to refactoring tools to migrate to the new Android support libraries in Jetpack — AndroidX.
The canary 14 release of Android Studio 3.2 also supports the new Android app model that is the evolution of the APK format, the Android App Bundle. With no code changes, Android Studio 3.2 will help you create a new Android App Bundle and have it ready for publishing on Google Play.
There are 20 major features in this release of Android Studio spanning from ultra fast Android Emulator Snapshots, Sample Data in the Layout Editor, to a brand new Energy Profiler to measure battery impact of your app. If any of these features sound interesting, download the preview of Android Studio 3.2 today.
To see these features demoed in action and to get a sneak peak at other features we are working on, check out the Google I/O 2018 session – What’s new in Android Development Tools .
Below is a full list of new features in Android Studio 3.2, organized by key developer flows.
- Navigation Editor – As a part of Jetpack, Android Studio 3.2 features a new way to design the navigational structure between the screens of your app. The navigation editor is a visual editor which allows you to construct XML resources that support using the new Navigation Component in Jetpack.
AndroidX Refactoring Support
– One of the components of Jetpack is rethinking and refactoring the Android Support Libraries to a new Android extension library (AndroidX) namespace. As a part of the early preview of the AndroidX, Android Studio 3.2 helps you through this migration with a new refactoring action. To use the feature, navigate to:
Refactor to AndroidX
. As an additional enhancement to the refactoring process, if you have any maven dependencies that have not migrated to the AndroidX namespace, the Android Studio build system will automatically convert those project dependencies as well. You can manually control the conversion process by toggling the
android.enableJetifier = trueflag in your
gradle.propertiesfile. While the refactoring action supports common project configurations, we recommend that you save a backup of your project before you refactor. Learn more .
AndroidX Refactoring Support
- Sample Data – Many Android layouts have runtime data that can make it difficult to visualize the look and feel of a layout during the design stage of app development. Sample Data in the Layout Editor allows you to use placeholder data to aid in the design of your app. From RecyclerView, ImageView to TextView, you can add built-in sample data to populate these views via a popup-window in the Layout Editor. To try out the feature, add a RecyclerView to a new layout, and then click on the new tools design-time attributes icon and choose a selection out of the carousel of sample data templates.
Design Time Sample Data
- Material Design Update – Material Design continues to evolve not only as a design system but also in implementation on Android. When you start migrating from the Android Design support library to the new MaterialComponents app theme and library, Android Studio 3.2 will offer you access to new and updated widgets such as BottomAppBar, buttons, cards, text fields, new font styles and more. Learn more .
New Material Design Components
- Slices support – Slices is a new way to embed portions of your app content in other user interface surfaces in the Android operating system. Slices is backwards compatible to Android 4.4 KitKat (API 19) and will enable you to surface app content in Google Search suggestions. Android Studio 3.2 has a built in template to help you extend your app with the new Slice Provider APIs as well as new lint checks to ensure that you’re following best practices when constructing the slices. To get started right-click on a project folder, and navigate to New → Other → Slice Provider . Learn how to test your slice interactions by checking out the getting started guide .
Slices Provider Template
- CMakeList Editing Support – Android Studio supports CMake build scripts for your app’s C/C++ code. With this release of Android Studio 3.2, code completion and syntax highlighting now works on common CMakeList commands.
CMakeList Code Completion
- What’s New Assistant –Android Studio 3.2 has a new assistant panel that opens automatically after an update to inform you about the latest changes to the IDE. You can also open the panel by navigating to Help → What’s New in Android Studio .
What’s New Assistant
- IntelliJ Platform Update – Android Studio 3.2 includes the IntelliJ 2018.1 platform release, which has many new features such as data flow analysis, partial Git commits support, and a ton of new code analysis enhancements. Learn more .
Android App Bundle
–The Android App Bundle is the new app publishing format designed to help you deliver smaller APKs to your users. Google Play has a new Dynamic Delivery platform that accepts your Android App Bundle, and delivers only the APKs that you need on a specific device. Android Studio 3.2 enables you to create and test an Android App Bundle. As long as you are running the latest Android Gradle plugin (
com.android.tools.build:gradle:3.2.0-alpha14), you can rebuild your code as an app bundle and get the benefit of smaller APKs based on language, screen density, and ABIs with no changes to your app code. To get started, navigate to Build → Build Bundle / APK or Build → Generate Signed Bundle / APK Learn more .
Build Android App Bundle
- D8 Desugaring – In some cases, new Java Language features require new bytecodes and language APIs, however older Android devices may not support these features. Desugaring allows you to use these features on older devices by replacing new bytecodes and language APIs with older ones during the build process. Desugaring was initially introduced with Android Studio 3.0 as a separate tool, and in Android Studio 3.1, we integrated the desugaring step into the D8 tool as an experimental feature, reducing overall build time. Now D8 desugaring is turned on by default for Android Studio 3.2. You can you can now use most of the latest language changes while targeting older devices.
– During the app build process, Android Studio historically used ProGuard to optimize and shrink Java language bytecode. Starting with Android Studio 3.2, we are starting the transition to use R8 as a replacement to ProGuard. To experiment with R8, add
android.enableR8=trueto your gradle.properties file. R8 is still experimental, so we do not recommend publishing your app using R8 yet. Learn more .
Enable R8 in Android Studio
in the Android Emulator we enabled you to launch the emulator in under 6 seconds. With Android Studio 3.2 we have extended this feature to enable you to create snapshots at any emulator state and start them iun under 2 seconds. When testing and developing your app, you can pre-configure an Android Virtual Device (AVD) snapshot with the presets, apps, data and settings that you want in-place, and repeatedly go back to the same snapshot. Snapshots load in under 2 seconds and you can launch to specific snapshots from the Android Emulator Extended Controls panel, the command-line (
./adb emu avd snapshot load snap_2018-04-29_00-01-12) or from within Android Studio.
Android Emulator Snapshots
Screen Record in Android Emulator
–Normally creating a screen recording of your app screen would only work for Android 4.4 KitKat (API 19) and above with no audio, with limited Android Emulator support. With the latest Android Emulator (v27.3+), you can take screen recordings on any API level with audio. Plus, there is a built-in conversion to output to GIF and WebM. You can trigger the new screen record feature via the Android Emulator Extended Controls panel, command line (
./adb emu screenrecord start --time-limit 10 /sample_video.webm), and from Android Studio .
Screen record in Android Emulator
- Virtual Scene Camera for Android Emulator – Developing and testing apps with ARCore is now even easier with the new Virtual Scene camera, which allows you to iterate on your augmented reality (AR) experience within a virtual environment. The emulator is calibrated to work with ARCore APIs for AR apps and allows you to inject virtual scene bitmap images. The virtual scene camera can also be used as a regular HAL3 compatible camera. Open the built-in Android camera app inside the Android Emulator to get started. By default, the new virtual scene camera is the rear camera for new Android Virtual Devices created with Android Studio 3.2. Learn more .
Virtual Scene Camera in Android Emulator
- ADB Connection Assistant – To help troubleshoot your Android device connections via ADB, Android Studio 3.2 has a new assistant. The ADB Connection Assistant walks you through common troubleshooting steps to connect your Android device to your development machine. You can trigger the assistant from the Run Dialogue box or by navigating to Tools → Connection Assistant .
ADB Connection Assistant
- Energy Profiler –Battery life is a key concern for many phone users, and your app may impact battery life more than you realize. The new Energy Profiler in the performance profiler suite can help you understand the energy impact of your app on an Android device. You can now visualize the estimated energy usage of system components, plus inspect background events that may contribute to battery drain. To use the energy profiler, ensure you are connected to an Android device or emulator running Android 8.0 Oreo (API 26) or higher. Learn more .
- System Trace –The new System Trace feature in the CPU Profiler allows you to inspect how your app interacts with system resources in fine-grained detail. Inspect exact timings and durations of your thread states, visualize where your CPU bottlenecks are across all cores, and add custom trace events to analyze. To use system trace, start profiling your app, click into the CPU Profiler, and then choose the System Trace recording configuration. Learn more .
- Profiler Sessions –We now automatically save Profiler data as “sessions” to revisit and inspect later while you have Android Studio open. We’ve also added the ability to import and export your CPU recordings and heap dumps for later analysis or inspection with other tools.
Automatic CPU Recording
– You can now automatically record CPU activity using the
. After you deploy your app to a device, the profiler automatically starts recording CPU activity when your app calls
startMethodTracing(String tracePath), and stops recording when your app calls
stopMethodTracing(). Similarly, you can also now automatically start recording CPU activity on app start-up by enabling this option in your run configuration.
- JNI Reference Tracking – For those of you who have C/C++ code in your Android app, Android Studio 3.2 now allows you to inspect the memory allocations of your JNI code in the Memory Profiler. As long as you deploy your app to a device running Android 8.0 Oreo (API 26) and higher, you can drill down into the allocation call stack from your JNI reference. To use the feature, start a memory profiler session, and select the JNI Heap from the Live Allocation drop-down menu.
JNI Reference Tracking
To recap, the latest canary of Android Studio 3.2 includes these new major features:
Check out the preview release notes for more details.
Download the latest version of Android Studio 3.2 from the canary channel download page . If you are using a previous canary release of Android Studio, make sure you update to Android Studio Canary 14 or higher. 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 at the same time. Learn more .
To use the mentioned Android Emulator features make sure you are running at least Android Emulator v27.3+ downloaded via the Android Studio SDK Manager.
We appreciate any early feedback on things you like, and issues or features you would like to see. Please note, to ensure we maintain product quality, the features you see in the canary channel may not be available in the next stable release channel until they are ready for stable usage. If you find a bug or issue, feel free to file an issue . Connect with us — the Android Studio development team ‐ on our Google+ page or on Twitter .