Android Studio 2.2来

Source: Internet
Author: User

I am I/o this year, Google released a preview of Android Studio 2.2, revealed that improved a number of features, but in order to ensure that the company's projects are not affected, I generally do not install the preview version, because the preview is meant to be unstable, may encounter a variety of unexpected pits, yesterday, Google finally released the official version of Android Studio 2.2, so hurry to experience the first time, according to Google, this update contains three aspects: speed, smarts, and Android platform support, out of the Meaning is faster, smarter, and adds a lot of useful features, let's take a look.

Layout Editor

This update brings a new layout editor that will make it easier to tune the UI later. Open an XML
File, the default Design mode as shown, mainly includes Palette, Component Tree, Toolbar, Design Editor, Properties five parts, direct visualization of the operation makes the layout more convenient and easy to operate.

Of course, for those of you who are accustomed to writing XML code, you can click the Text in the lower left corner to switch to the code format, but the right can still be previewed. The Text mode is as follows:

Here is a small trick, you can operate the shortcut key Control+shift+right/left to switch left and right.

Then we can configure the theme appearance of our preview through the Toolbar column.

Comment: The improvement is more convenient, you can teach your designers to help you adjust the UI.

Constraint Layout

Constraint layout translation I call it constrained layout, it is also this year Google introduced a new layout, it is more powerful, simply speaking, with Constraint layout can be achieved before the need for a variety of nested to achieve the effect, We know that too much layout nesting has a big impact on performance, because Constraint layout is more powerful, so there are many attributes, but Google provides a visual operation, a dynamic diagram that you feel:

Detailed usage of Constraint Layout here is not much to say, Google official has a tutorial, want to learn to see here:

Using constraintlayout to design your views

Friendship Tips, the above links need scientific Internet, English reading difficulties may wish to look at this blog, I think the writing is quite good:

Android Constraintlayout Detailed

The above Google's improvements to the UI layout can be seen, Google's idea is to make the layout more intelligent and visual, for some of the students just contact with Android has no intention to greatly reduce the threshold, but for some older programmers, such as me, or used to directly write code to adjust the UI directly.

Comment: This layout is very powerful, but the baby does not like to drag and drop, feel the designer can start to learn Android.

Samples Browser

I wonder if you know that Google has a Google Samples on GitHub, which lists hundreds of examples of Google's code, most of which are Android-related, such as Navigationdrawer. , Google has an example of a android-navigationdrawer. And this time Google directly linked to Android Stduio, you can select a class in Android Studio directly right click on Find Sample Code, the magic happened:

You can see the Packagemanager as an example, there are some Google Sample related code directly below, so that you quickly find the usage, and there is a link directly to the Android Developer official website of this kind of detailed introduction, simply not too convenient, I love this feature!

Comment: This function is very practical.

Instant Run Improvements

Instant Run's launch is really good, but the first time the Mother Egg compilation is too slow, because the compilation is too slow I generally disable the function. Let's take a look at Google's official update notes:

In this release, we had made many stability and reliability improvements to Instant Run. If you had previously disabled Instant Run, we encourage you to re-enable it and let us know if you come across further I Ssues.

Lying trough, read I laughed dead, the original Google knew we would put Instant Run function disable Ah, according to Google said this update made improvements, more stable, faster. Encourage us to open the Instant Run function, well, I tried it, and it's really faster than before, and you can reopen the experience. Open method See:

Comment: This time I finally opened the Instant Run function.

Build Cache (Experimental)

In fact, just upgrade as is strongly prompted me to upgrade Gradle to 2.14 version, only need to upgrade the Android Gradle plugin version to 2.2.0.

classpath ‘com.android.tools.build:gradle:2.2.0‘

To speed up the compilation of Gradle, Google has added a feature to compile the cache, but it is still experimental, the specific use is to add such a line of code in your gradle.properties file:

android.enableBuildCache=true

Overall upgrade Gradle, plus such a code, do feel the compilation is faster, we can feel the next.

Yes, each compilation generates a cache in the ~/users/.android/build-cache directory, and if the cache is too large you can manually delete the directory for cleanup.

Comment: Compile really fast, do not know is not the illusion.

APK Analyzer

Google has launched an APK
Analyzer, now it's easy to use Android Studio for APK analysis. For specific usage click Build-Analyze apk and select the apk file you want to analyze.

    • Easy to view all files and sizes

    • Can view Androidmanifest.xml files directly

    • You can view resource files directly

View pictures

View XML resource files

    • You can view the Dex file directly

    • You can also compare two apk

Comment: This function is called artifact Ah, after everyone will reverse APK.

Virtual sensors in the Android Emulator

Google also improved the simulator this time, let the simulator support the virtual sensor, you feel.

Comment: It's useless for me to be a person who never uses a simulator.

Espresso Test Recorder (Beta)

Google has added a new feature for testing, that is, we can record the operation and then generate some test scripts based on our actions, and it will be more convenient to work with Firebase.

Comment: Theoretically this function is very good, can liberate the test staff's hands, but the function or test, should be very unstable, and the domestic market combined with Firebase is very difficult, the development significance, can continue to pay attention.

Summarize

In addition to the above, this update also includes support for Java 8, Jack compiler improvements, you can debug the GPU, improved support for C + +, in general, the update introduced a lot of Android development efficiency to improve the tool, performance has also been optimized, it is worth updating!

Official Update notes:

Android Studio 2.2

The original published in the public number Androiddeveloper, reproduced please be sure to indicate the source!

Android Studio 2.2来

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.