Posted by Agustin Fonts, Product Manager, Android Support Library
It's important to keep current when you're dealing with technology. That’s why we're constantly working to improve the quality of our software, particularly libraries that are linked into your apps, such as the Support Library. The Support Library is a suite of libraries that provides backward compatibility along with additional features across many Android releases.
We have just released version 25.2 of the Support Library. If you're making use of the android.support.v7.media.MediaRouter class in revision 25.1.1 or 25.1.0, we strongly recommend that you update due to a known issue. If you haven't updated recently, you've missed out on some great bug fixes such as these:
25.2:
Corrected a severe mediarouter issue in which using an A2DP Bluetooth device and media routing APIs could cause the device to become unresponsive, requiring a reboot
Showing a slide presentation with screen mirroring no longer causes the device to disconnect from Wi-Fi
Media button now properly handles media apps that did not register themselves with setMediaButtonReceiver()
TextInputLayout correctly overlays hint and text if text is set by XML (AOSP issue 230171)
Corrected a memory leak in MediaControllerCompat (AOSP issue 231441)
RecyclerView no longer crashes when recycling view holders (AOSP issue 225762)
Reporting (and fixing) a Bug
The Support Library is developed by the Android Framework and Developer Relations teams, and, just like the Android platform, you can file bugs using the AOSP issue tracker, or submit fixes to our Git repository. Your feedback is critical in helping us to make the Support Library the most productive environment to use for developing Android applications.
Android Studio 2.2 launched recently with href="http://android-developers.blogspot.com/2016/09/android-studio-2-2.html">many new and improved features. Some of the changes are easy to miss because they happened under the hood in the Android Gradle plugin, such as the newly rewritten integrated APK packaging and signing step.
APK Signature Scheme v2
With the introduction of the new href="https://source.android.com/security/apksigning/v2.html">APK Signature Scheme v2 in Android 7.0 Nougat, we decided to rewrite how assembling APKs works in the Android Gradle plugin. You can read all about the low-level technical details of v2 signatures in the href="https://source.android.com/security/apksigning/v2.html">documentation, but here's a quick tl;dr summary of the info you need as an Android app developer:
The cryptographic signature of the APK that is used to verify its integrity is now located immediately before the ZIP Central Directory.
The signature is computed and verified over the binary contents of the whole APK file, as opposed to decompressed file contents of each file in the archive in v1.
An APK can be signed by both v1 and v2 signatures at the same time, so it remains backwards compatible with previous Android releases.
Why introduce this change to how Android verifies APKs? Firstly, for enhanced security and extensibility of this new signing format, and secondly for performance - the new signatures take significantly less time to verify on the device (no need for costly decompression), resulting in faster app installation times.
The consequence of this new signing scheme, however, is that there are new constraints on the APK creation process. Since only uncompressed file contents were verified in v1, that allowed for quite a lot of modifications to be made after APK signing - files could be moved around or even recompressed. In fact, the zipalign tool which was part of the build process did exactly that - it was used to align ZIP entries on correct byte boundaries for improved runtime performance.
Because v2 signatures verify all bytes in the archive and not individual ZIP entries, running zipalign is no longer possible after signing. That's why compression, aligning and signing now happens in a single, integrated step of the build process.
If you have any custom tasks in your build process that involve tampering with or post-processing the APK file in any way, please make sure you disable them or you risk invalidating the v2 signature and thus making your APKs incompatible with Android 7.0 and above.
Should you choose to do signing and aligning manually (such as from the command line), we offer a new tool in the Android SDK, called href="https://developer.android.com/studio/command-line/apksigner.html?utm_campaign=android_discussion_api_111016&utm_source=anddev&utm_medium=blog">apksigner, that provides both v1 and v2 APK signing and verification. Note that you need to run zipalignbefore running apksigner if you are using v2 signatures. Also remember the jarsigner tool from the JDK is not compatible with Android v2 signatures, so you can't use it to re-sign your APKs if you want to retain the v2 signature.
In case you want to disable adding v1 or v2 signatures when building with the Android Gradle plugin, you can add these lines to your href="https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.SigningConfig.html">signingConfig section in build.gradle:
Note: both signing schemes are enabled by default in Android Gradle plugin 2.2.
Release builds for smaller APKs
We took this opportunity when rewriting the packager to make some optimizations to the size of release APKs, resulting in faster downloads, href="http://android-developers.blogspot.co.uk/2016/07/improvements-for-smaller-app-downloads.html">smaller delta updates on the Play Store, and less wasted space on the device. Here are some of the changes we made:
Files in the archive are now sorted to minimize differences between APK builds.
All file timestamps and metadata are zeroed out.
Level 6 and level 9 compression is checked for all files in parallel and the optimal one is used, i.e. if L9 provides little benefit in terms of size, then L6 may be chosen for better performance
Native libraries are stored uncompressed and page aligned in the APK. This brings support for the android:extractNativeLibs="false" option from Android 6.0 Marshmallow and lets applications use less space on the device as well as generate smaller updates on the Play Store
Zopfli compression is not used to better support Play Store update algorithms. It is not recommended to recompress your APKs with Zopfli. Pre-optimizing individual resources such as PNG files in your projects is still fine and recommended.
These changes help make your releases as small as possible so that users can download and update your app even on a slower connection or on less capable devices. But what about debug builds?
Debug builds for installation speed
When developing apps you want to keep the iteration cycle fast - change code, build, and deploy on a connected device or emulator. Since Android Studio 2.0 we've been working to make all the steps as fast as possible. With Instant Run we're now able to update only the changed code and resources during runtime, while the new Emulator brings multi-processor support and faster ADB speeds for quicker APK transfer and installation. Build improvements can cut that time even further and in Android Studio 2.2 we're introducing incremental packaging and parallel compression for debug builds. Together with other features like selectively packaging resources for the target device density and ABI this will make your development even faster.
A word of caution: the APK files created for Instant Run or by invoking a debug build are not meant for distribution on the Play Store! They contain additional instrumentation code for Instant Run and are missing resources for device configurations other than the one that was connected when you started the build. Make sure you only distribute release versions of the APK which you can create using the Android Studio href="https://developer.android.com/studio/publish/app-signing.html?utm_campaign=android_discussion_api_111016&utm_source=anddev&utm_medium=blog#release-mode">Generate Signed APK command or the assembleRelease Gradle task.
Posted by Kathryn Shih, Android Product Manager
In addition to supporting the experimental Gradle plugin, href="http://android-developers.blogspot.com/2016/09/android-studio-2-2.html">Android Studio 2.2 enables you to build C/C++ components of Android projects using CMake and ndk-build.
The Android Studio team plans to continue to support the experimental Gradle plugin. This will eventually replace the current Gradle plugin, providing additional tightly-integrated benefits to C/C++ developers such as smarter dependency management. So if you're interested in someday having the smartest possible interface between your IDE and your build system, you shouldn't ignore the experimental plugin.
CMake and ndk-build are useful alternatives to Gradle in several cases:
Projects that are already using CMake or ndk-build, such as legacy Eclipse ndk projects
Projects that are unable to assume the risk of using an experimental plugin for their C/C++ builds
Projects that will share a C/C++ build system across multiple platforms
C/C++ projects that need to use advanced features currently unavailable in experimental Gradle such as NEON support
For new projects, we recommend using CMake or experimental Gradle. For new Android projects with limited C++, we recommend trying the experimental Gradle plugin. For projects with substantial amounts of C++, or where you want the maximally stable build configuration, we recommend using a CMake build. Android Studio intends CMake to be a permanently supported solution.
While we think that there are substantial advantages to having a single build system able to handle all parts of an Android application, stabilizing the experimental plugin is not an option for us because it relies on Gradle APIs that are still a work in progress. Until the Gradle APIs are stabilized, the experimental plugin will keep changing, particularly in its Domain Specific Language, and will be strictly tied to a very specific version of Gradle itself.
Note that the the old, undocumented ndkCompile integration is deprecated. If you are using it, you need to move away from it as we'll remove it completely in the near future. We recommend migrating to gradle+cmake via our href="https://developer.android.com/studio/projects/add-native-code.html?utm_campaign=android_discussion_cmake_110716&utm_source=anddev&utm_medium=blog">migration guide.
Migrating from Eclipse to Android Studio
href="https://android-developers.blogspot.com/2016/11/support-ended-for-eclipse-android.html">We no longer support the Eclipse ADT. To get started migrating, href="https://developer.android.com/studio/index.html?utm_campaign=android_discussion_cmake_110716&utm_source=anddev&utm_medium=blog">download and install Android Studio. For most projects, migration is as simple as importing your existing Eclipse ADT projects in Android Studio with the File → New→ Import Project menu option. For more details on the migration process, check out the href="https://developer.android.com/studio/intro/migrate.html?utm_campaign=android_discussion_cmake_110716&utm_source=anddev&utm_medium=blog">migration guide.
Feedback and Open Source Contributions
We're dedicated to making Android Studio the best possible integrated development environment for building Android apps, so if there are missing features or other challenges preventing you from using Android Studio, href="https://goo.gl/forms/aGz9hQyRaTRQzN4s1">we want to hear about it [href="https://goo.gl/forms/aGz9hQyRaTRQzN4s1">please take our survey]. You can also file bugs or feature requests directly with the team, and let us know via our href="http://www.twitter.com/androidstudio">Twitter or href="https://plus.google.com/103342515830390186255">Google+ accounts.
Android Studio is an open source project, available to all at no cost. Check out our href="http://tools.android.com/contributing">Open Source project page if you're interested in contributing or learning more.
With the release of href="http://android-developers.blogspot.com/2016/09/android-studio-2-2.html">Android Studio 2.2, the time has now come to say goodbye to the Eclipse Android Developer Tools. We have formally ended their support and development. There's never been a better time to switch to Android Studio and experience the improvements we've made to the Android development workflow.
Android Studio
Android Studio, the official IDE for Android, features powerful code editing with advanced code-completion and refactoring. It includes robust href="https://developer.android.com/studio/write/lint.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">static analysis, bringing the intelligence of the Android engineering team to you to help you easily apply Android coding best practices, and includes simultaneous debugging in both Java and C++ to help fix any bugs that slip through. When you combine this with performance tooling, a fast, flexible build system, code templates, GitHub integration, and its high-performance, feature-rich emulator, you get a deeply Android-tailored development environment for the many form factors of the OS. It's the development environment used by 92% of the top 125 Google Play apps and games, and we're constantly innovating it to handle every Android development need.
What's New in Android Studio 2.2
href="http://android-developers.blogspot.jp/2016/09/android-studio-2-2.html">Android Studio 2.2 builds on the great features from Android Studio 2.0. There are over twenty new features that improve development whether you are designing, iterating, or testing. Notable changes include:
href="https://developer.android.com/studio/run/index.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">Instant Run - The super-fast iteration engine now is both more reliable and available for more types of changes
href="https://developer.android.com/studio/write/layout-editor.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">Layout Editor - The new user interface designer that makes it easier than ever to create beautiful app experiences
href="https://developer.android.com/training/constraint-layout/index.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">Constraint Layout - A new flexible layout engine for building dynamic user interfaces - designed to work with the new layout editor
href="https://developer.android.com/studio/projects/add-native-code.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">C++ Support - CMake and ndk-build are now supported alongside improved editing and debug experiences
href="https://developer.android.com/studio/build/apk-analyzer.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">APK Analyzer - Inspects APKs to help you streamline your APK and debug multi-dex issues
href="https://developer.android.com/studio/debug/am-gpu-debugger.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">GPU Debugger (beta) - Captures a stream of OpenGL ES commands and replays them with GPU state inspection
href="https://developer.android.com/studio/test/espresso-test-recorder.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">Espresso Test Recorder (beta) - Records interactions with your app and outputs UI test code
Top Developers Love Android Studio
For our ADT Fans
All of your favorite ADT tools are now part of Android Studio, including DDMS, Trace Viewer, Network Monitor, and CPU Monitor. We've also improved Android Studio's href="https://developer.android.com/studio/intro/accessibility.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">accessibility, including keyboard navigation enhancements and screen reader support.
We href="http://android-developers.blogspot.com/2015/06/an-update-on-eclipse-android-developer.html">announced that we were ending development and official support for the Android Developer Tools (ADT) in Eclipse at the end of 2015, including the Eclipse ADT plugin and Android Ant build system. With the latest updates to Studio, we've completed the transition.
Migrating to Android Studio
To get started, href="https://developer.android.com/studio/index.html?utm_campaign=android_deprecation_eclipse_110216&utm_source=anddev&utm_medium=blog">download and install Android Studio. For most developers, including those with C/C++ projects, migration is as simple as importing your existing Eclipse ADT projects in Android Studio with the File > New > Import Project menu option. For more details on the migration process, check out the href="https://developer.android.com/studio/intro/migrate.html?utm_campaign=eclipse-626&utm_source=dac&utm_medium=blog">migration guide.
Feedback and Open Source Contributions
We're dedicated to making Android Studio the best possible integrated development environment for building Android apps, so if there are missing features or other challenges preventing you from switching to Android Studio, href="https://goo.gl/forms/aGz9hQyRaTRQzN4s1">we want to hear about it [href="https://goo.gl/forms/aGz9hQyRaTRQzN4s1">survey] ! You can also href="http://tools.android.com/filing-bugs">file bugs or feature requests directly with the team, and let us know via our href="http://www.twitter.com/androidstudio">Twitter or href="https://plus.google.com/103342515830390186255">Google+ accounts.
Android Studio is an open source project, available to all at no cost. Check out our href="http://tools.android.com/contributing">Open Source project page if you're interested in contributing or learning more.
Android Studio 2.2 is available to href="https://developer.android.com/studio/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">download today. Previewed at Google I/O 2016, Android Studio 2.2 is the latest release of our IDE used by millions of Android developers around the world.
Packed with enhancements, this release has three major themes: speed, smarts, and Android platform support. Develop faster with features such as the new Layout Editor, which makes creating an app user interface quick and intuitive. Develop smarter with our new APK analyzer, enhanced Layout Inspector, expanded code analysis, IntelliJ’s 2016.1.3 features and much more. Lastly, as the official IDE for Android app development, Android Studio 2.2 includes support for all the latest developer features in Android 7.0 Nougat, like href="https://developer.android.com/studio/intro/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog#code_completion">code completion to help you add Android platform features like href="https://developer.android.com/about/versions/nougat/android-7.0.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog#multi-window_support">Multi-Window support, href="https://developer.android.com/about/versions/nougat/android-7.0.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog#tile_api">Quick Settings API, or the redesigned href="https://developer.android.com/about/versions/nougat/android-7.0.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog#notification_enhancements">Notifications, and of course, the built-in href="https://developer.android.com/studio/run/emulator.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Android Emulator to test them all out.
In this release, we evolved the Android Frameworks and the IDE together to create the Constraint Layout. This powerful new layout manager helps you design large and complex layouts in a flat and streamlined hierarchy. The ConstraintLayout integrates into your app like a standard Android support library, and was built in parallel with the new Layout Editor.
Android Studio 2.2 includes 20+ new features across every major phase of the development process: design, develop, build, & test. From designing UIs with the new ConstraintLayout, to developing C++ code with the Android NDK, to building with the latest Jack compliers, to creating Espresso test cases for your app, Android Studio 2.2 is the update you do not want to miss. Here’s more detail on some of the top highlights:
Design
Layout Editor: Creating Android app user interfaces is now easier with the new user interface designer. Quickly construct the structure of your app UI with the new blueprint mode and adjust the visual attributes of each widget with new properties panel. href="https://developer.android.com/studio/write/layout-editor.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Learn more.
Layout Editor
Constraint Layout: This new layout is a flexible layout manager for your app that allows you to create dynamic user interfaces without nesting multiple layouts. It is backwards compatible all the way back to Android API level 9 (Gingerbread). ConstraintLayout works best with the new Layout Editor in Android Studio 2.2. href="https://developer.android.com/training/constraint-layout/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Learn more.
ConstraintLayout
Develop
Improved C++ Support: You can now use href="https://developer.android.com/studio/projects/add-native-code.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">CMake or ndk-build to compile your C++ projects from Gradle. Migrating projects from CMake build systems to Android Studio is now seamless. You will also find C++ support in the new project wizard in Android Studio, plus a number of bug fixes to the C++ edit and debug experience. href="https://developer.android.com/studio/projects/add-native-code.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Learn more.
C++ Code Editing & CMake Support
Samples Browser: Referencing href="http://developer.android.com/samples/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Android sample code is now even easier with Android Studio 2.2. Within the code editor window, find occurrences of your app code in Google Android sample code to help jump start your app development. Learn more.
Sample Code Menu
Build
Instant Run Improvements: Introduced in Android Studio 2.0, href="https://developer.android.com/studio/run/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog#instant-run">Instant Run is our major, long-term investment to make Android development as fast and lightweight. Since launch, it has significantly improved the edit, build, run iteration cycles for many developers. In this release, we have made many stability and reliability improvements to Instant Run. If you have previously disabled Instant Run, we encourage you to re-enable it and let us know if you come across further issues. (Settings → Build, Execution, Deployment → Instant Run [Windows/Linux] , Preferences → Build, Execution, Deployment → Instant Run [OS X]). For details on the fixes that we have made, see the href="https://developer.android.com/studio/releases/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Android Studio 2.2 release notes.
Enable Instant Run
APK Analyzer: Easily inspect the contents of your APKs to understand the size contribution of each component. This feature can be helpful when debugging href="https://developer.android.com/studio/build/multidex.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">multi-dex issues. Plus, with the APK Analyzer you can compare two versions of an APK. href="https://developer.android.com/studio/build/apk-analyzer.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Learn more.
APK Analyzer
Build cache (Experimental): We are continuing our investments to improve build speeds with the introduction of a new experimental build cache that will help reduce both full and incremental build times. Just add android.enableBuildCache=true to your gradle.properties file. href="http://tools.android.com/tech-docs/build-cache">Learn more.
Build Cache Setting
Test
Virtual Sensors in the Android Emulator: The Android Emulator now includes a new set of virtual sensors controls. With the new UI controls, you can now test href="https://developer.android.com/guide/topics/sensors/sensors_overview.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Android Sensors such as Accelerometer, Ambient Temperature, Magnetometer and more. Learn more.
Android Emulator Virtual Sensors
Espresso Test Recorder (Beta): The Espresso Test Recorder lets you easily create UI tests by recording interactions with your app; it then outputs the href="https://developer.android.com/topic/libraries/testing-support-library/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog#Espresso">UI test code for you. You record your interactions with a device and add assertions to verify UI elements in particular snapshots of your app. Espresso Test Recorder then takes the saved recording and automatically generates a corresponding UI test. You can run the test locally, on your continuous integration server, or using href="https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog#run-ctl">Firebase Test Lab for Android. href="https://developer.android.com/studio/test/espresso-test-recorder.html">Learn more.
Espresso Test Recorder
GPU Debugger (Beta): The GPU Debugger is now in Beta. You can now capture a stream of OpenGL ES commands on your Android device and then replay it from inside Android Studio for analysis. You can also fully inspect the GPU state of any given OpenGL ES command to better understand and debug your graphical output. href="https://developer.android.com/studio/debug/am-gpu-debugger.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Lean more.
GPU Debugger
To recap, Android Studio 2.2 includes these major features and more:
href="https://developer.android.com/studio/write/vector-asset-studio.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">PSD File Support in Vector Asset Studio
href="https://developer.android.com/studio/intro/accessibility.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Enhanced accessibility support
href="https://developer.android.com/studio/projects/add-native-code.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">C++ ndk-build or CMake
href="https://developer.android.com/studio/test/espresso-test-recorder.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">Espresso Test Recorder (Beta)
href="https://developer.android.com/studio/run/emulator.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog#extended">Virtual Sensors in the Android Emulator
Learn more about Android Studio 2.2 by reviewing the href="https://developer.android.com/studio/releases/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">release notes and the href="http://android-developers.blogspot.com/2016/05/android-studio-22-preview-new-ui.html">preview blog post.
Getting Started
Download
If you are using a previous version of Android Studio, you can check for updates on the Stable channel from the navigation menu (Help → Check for Update [Windows/Linux] , Android Studio → Check for Updates [OS X]). You can also download Android Studio 2.2 from the official href="https://developer.android.com/studio/index.html?utm_campaign=android studio_launch_2.2_091916&utm_source=anddev&utm_medium=blog">download page. To take advantage of all the new features and improvements in Android Studio, you should also update to the Android Gradle plugin version to 2.2.0 in your current app project.
Next Release
We would like to thank all of you in the Android Developer community for your work on this release. We are grateful for your contributions, your ongoing feedback which inspired the new features in this release, and your highly active use on canary and beta builds filing bugs. We all wanted to make Android Studio 2.2 our best release yet, with many stability and performance fixes in addition to the many new features. For our next release, look for even more; we want to work hard to address feedback and keep driving up quality and stability on existing features to make you productive.
We appreciate any feedback on things you like, issues or features you would like to see. Connect with us -- the Android Studio development team -- on our href="https://plus.google.com/103342515830390186255">Google+ page or on href="http://www.twitter.com/androidstudio">Twitter.