Tuesday, January 15, 2019

Android Studio 3.5 Canary 1 available


Android Studio 3.5 Canary 1 is now available in the Canary and Dev channels.

If you have Android Studio set to receive updates on the Canary or Dev channel, you can get the update by choosing Help > Check for Updates (Android Studio > Check for Updates on macOS). Otherwise, you can download it here.

Apply Changes

Canary 1 of Android Studio 3.5 introduces a preview of Apply Changes, which replaces Instant Run. We know that Instant Run has in the past caused issues for many of you, and the feature hasn’t lived up to our quality standards. Instant Run rewrote the bytecode of your APK at build time to inject hooks to replace classes on the fly. For simple apps, this was largely fine, but for more complex apps, this could result in longer build times or head-scratching errors caused by conflicts between your app and Instant Run’s build process.

We’ve taken a step back and decided to rewrite it from the ground up. As a result, Apply Changes no longer modifies your APK during builds. Instead, we rely on runtime instrumentation that is supported in the Android platform in 8.0 and newer devices to redefine classes on the fly.

We’ve also reacted to feedback around the unpredictability and inconsistency in behavior of the Instant Run button that would automatically decide whether or not to restart your app or activity if necessary; we now explicitly prompt you if we detect that your change is not compatible with Apply Changes.

It’s still early days for this feature, but we’d love to hear any feedback you may have. In particular, if you had issues using Instant Run in the past, please give Apply Changes a try and let us know what you think. If you encounter any issues while using it, please file a bug and attach your corresponding idea.log file.

We’ll be communicating more details about Apply Changes and what we’ve done under the hood soon.

To use Apply Changes:
  • If you want to apply only your code changes without restarting the current activity, click Apply Code Changes Apply Code Changes icon or press Ctrl+Alt+F10 (or Command+Shift+Ctrl+R on macOS).
  • If you want to apply your resource and code changes without restarting your app, click Apply Changes Apply Changes icon or press Ctrl+F10 (or Command+Ctrl+R on macOS).

Limitations

  • Apply Changes is only compatible with devices running API 26 (Android 8.0 / O) or later.
  • Like Instant Run, certain changes cannot be applied unless the app is restarted, including:
    • Adding or deleting a class, method, or field
    • Changes in the manifest
    • Changing method signatures
    • Changing modifiers of methods or classes
    • Renaming classes
    • Changing class inheritance
    • Adding or removing a resource

Known issues

  • The speed of deploying using Apply Changes may be currently slower than Instant Run. Our initial priority was stability of the feature, and we’ll be improving the performance throughout the coming months in Canary.
  • Apply Changes while debugging is currently only supported on API 28 (Android 9.0 / P).
  • You may see unexpected behavior if you use custom classloaders other than the system and application thread context ones to load classes.
  • Apply Changes will not work on x86_64 emulator images.

General fixes

This update also includes fixes for the following public issues: