Recent Changes‎ > ‎

Android Studio 2.0 Preview 5 Available

posted Jan 14, 2016, 10:46 AM by Tor Norbye
We've just pushed Android Studio 2.0 Preview 5 to the canary channel. This build contains a large number of fixes relative to Preview 4 from last month, including
  • Instant Run: We've made a huge number of changes in this area. Among the user visible features, we now support "cold swap": if there is an incompatible change that can't be hot swapped, it now builds and deploys incremental changes and restarts the app. We use several different methods for this, depending on the API level of the target device:
    • On Android Marshmallow, we use "APK splits", dividing the codebase up into slices that are packaged as individual APK slices, and install these via adb install-multiple. This means that on M, we don't need to use the class loader tricks that we use on older platforms.
    • On Android Lollipop, we use multidex to split the app code into dex slices, and push those.
    • On Android KitKat and below, we create a single dex file containing the changed classes.
    • In addition to "coldswap", which restarts a running app after applying incompatible changes, we also support "freeze swap" where we support building incrementally even when the app isn't originally running. In that case, we push the changes via adb to an "inbox" directory on the device.
    • Note that Instant Run now requires a new version of the Gradle plugin: 2.0-alpha5 (also released today) - release notes for the plugin
  • Lint
    • There is a new "Remove Unused Resources" refactoring which finds and removes unused resources in the project.
    • The unused resource detector has been rewritten, and now supports flagging "transitive" unused resources (resources that are referenced, but only from other unused resources), supports detecting resource references in raw files such as .html image references, and supports the tools:keep and tools:discard attributes used by the Gradle resource shrinker, it considers inactive source sets (e.g. resources defined in other product flavors and build types), and properly handles static field imports. It now also has a quickfix for removing unused resources.
    • Implicit API checks. Until now, lint has checked that method calls and field references are supported on all platforms targeted by your minSdkVersion. However, there are a number of classes that have started implementing new interfaces, such as Closeable, in later levels - or that have even changed which super class they extend. For example, KeyEvent only has InputEvent as a super class as of API 9. That means that in all the places where you have an implicit or explicit cast, you also have a potential crash. Lint now tracks these API changes and checks all implicit casts:
    • Several new lint checks - one looking for a common pitfall in RecyclerView usage, one looking for a potential crash with Parcelable loading, as well as 8 lint checks ported from bytecode analysis to in-IDE analysis such that they can run in the background in the editor.
    • The @IntDef, @IntRange and @Size inspections are now checked not just for primitive ints, but for int arrays and varargs as well.
    • A number of other miscellaneous improvements, such as lint now running even when there are syntax errors in the current file being edited, exposing lint issue categories in the IDE analysis window, fixes to make third party lint rules (provided from AAR libraries) work better inside the IDE, etc.
  • Data binding: The XML editor now support code completion for data binding expressions.
  • Test Artifacts: The experimental test artifacts feature (where both unit test and instrumentation tests are enabled simultaneously in the IDE) has been improved further and is now enabled by default.
  • Code completion inside style tags should now work better; it looks up the parent styles and suggests eligible items.
  • We've also been working on improving the accessibility support, as well as infrastructure work on the SDK manager and the wizard infrastructure.
  • And as always - a large number of bug fixes. Please let us know if there are new problems, or if the fixes aren't working correctly!

Installation
You can update your current 2.0 Preview installation to Preview 5 via the built-in patch mechanism (Check for Updates).
You can also update from 1.5 to 2.0 Preview via the patch mechanism, but you may not want to do that: See our page about how to keep multiple installations simultaneously while Studio is in preview mode.
You can also download a full zip of 2.0 Preview from the Android Studio 2.0 Preview 5 page.

Problems?
If you run into problems, be sure to check the Known Issues page which we'll update as necessary.

Comments