Last year's Google conference, Google brought us a small toy--android Studio, said it is a toy, because it does compare dishes, the interface is outdated, the operation is not smooth, not high efficiency, but now, Although the version is still 0.6, not even to 1.0, but we can find that the son is a pro son, now the Android studio has not changed, with a period of time, simply put it down, I think, It ' s time to say goodbye eclipse!
This article will lead you to a thorough understanding of Android Studio, note: Because of the reasons of the celestial, our understanding of the process will be more tortuous, but eventually everyone will see the dawn, and then you do not want to go back to the dark!
First, download, website address:: https://developer.android.com/sdk/installing/studio.html#download
Think about it or not, and so you can open more than a few lines of code, we can go to some of the domestic diversion site download, everyone enjoy Baidu, this is not difficult.
This is the goods!
Installation I will not say, are programmers, nothing difficult, but some people install error:
Most of the startup failure is due to the JDK environment variable problem, when setting up the JDK note that the environment variable added OK.
Then it is the startup process:
And Eclipse is still more like.
Choose New or import to start our project, the first time you create, to download some things gradle, it will be a bit slow.
If the project is inside Eclipse, we can export it to Android studio format and it is easy to import Android studio development.
Select Export as Gradle build file is OK.
When you import, Android Studio will automatically recognize it.
This gradle is very big, is the Google used for intelligent building project building integration tools, specific use can Baidu, in short, he can put a large string of compile command with a line of code to complete.
Since it's so cool, slow down.
As you can see, memory usage is still excellent, not as much as Eclipse does on G.
Once configured for the first time, we are ready to go to the start-up interface, where I am importing an Eclipse project to demonstrate:
Let's Shake it all down:
is not very good bright!
But this is still hard to come by, first of all we have to solve the problem of face:
In fact, the default interface is not this way, a bit like eclipse, anyway, is white bottom first we face:
Click Settings:
That's the little wrench, and then choose Appearance.
Choose theme for Darcula, this is the programmer to install force or eye care. The breakfast was perfect.
Then in order to solve the problem of Chinese display, we need to set the next font, the proposed Microsoft Jas, the size of their own settings.
Then set the font for the following edit area:
Just take a name and save as a bit to edit it.
To meet the voice of the vast number of programmers, we also want to set up something, such as automatic prompt, have to say, Android Studio automatic prompt function is very powerful, but, if you want to enter "string", you enter "string", this is not prompt, that is, case-sensitive, Isn't that right? Very simple:
Choose the case is not sensitive, OK! This way you want to tip how to prompt!
Then there is a little uncomfortable, used to eclipse the people will find that the mouse hover on the program when, nothing! Well, right, Android Studio default is no mouse hover hint, want to use shortcut key Ctrl+q, this also has the advantage, the comparison configuration is too poor computer will not die. But some of the more nostalgic refused, OK, we change:
See no, according to the check on the picture OK, familiar hints come out.
There are some other settings such as line number ah, tab number AH, what format ah, everyone in the editor can find settings, relatively simple, we are self-reliance it.
OK, our face is getting better, let's give him the soul below.
Currently the latest version is 0.6, if the previous version of the upgrade to 0.6, we will be surprised to find that the new PJ is wrong! Well, yes, compared to the pit dad is not, I just started when also depressed, and even unloaded n times. The final summary of how to fix this problem:
In a word, this problem is sensitive words, we all understand, the rich please use a VPN, money, no money, please modify the host file, specifically, you can refer to my previous article:
A sigh of a celestial programmer--Change the hosts bar
Then we open the SDK Manager, no accident, we can not see the following things, unless changed the host, with a VPN, I have been here for nearly 2 hours,
Finally, with the help of various resources, happened to have the right, in this share, I hope not to be the wall again!
Of course, to tick force, this is what everyone knows.
First, we're going to upgrade the build tool, which is the source of the error!
Various errors, such as:
Error:1 0 plugin with id ' Android ' not found.
What else:
Error:2 0 .......
We will first upgrade down to 19.1.0.
Then we need to modify the following in the project
Change the default 19.0.3 to 19.1.0 and try aging OK.
So far, basically no more mistakes, if wrong please wash your face, find a lucky day and try again.
Let's take a look at some of the places where it's awesome:
It can be seen that, compared to eclipse, it is post-modern, Google engineers spend a lot of time, analysis of various code writing specifications, and in Android studio to achieve, a piece of code how to write better, a little know, code folding function, but also let everyone see more pleasing.
The Code hints function is more and more perfect, this is eclipse cannot compare.
Below we want to see its most dazzling place, real-time UI design features, we all know this time Apple came a playground, can be programmed to preview the effect, it feels really good, we Android programmers have to scare urine, in fact, the urine was found, It is really a playground, the current function is just let you play, not to the level we want to, but do want to praise one, if you can really do this programming, estimated that every is a coder.
This version, UI design more and more awesome, can be programmed to preview the effect, of course, just XML, not the real-time compilation run preview, alas, I hope this day early arrival.
A casual interface, do not spray me, thank you:
Design interface, and then look at the text interface:
Really, now do the UI is not much more convenient, no longer like a fool to keep cutting tab to see the effect.
And then look at some common features:
New:
Why is it so awesome, because he can determine the type you want to create, whether it's a Java file or a resource file, depending on where you choose, as well as a variety of templates:
Very convenient to have wood there.
Look again at the new project:
Automatic integration of a variety of templates, convenient +1 wood has.
Then look at the new templates:
Go back to use Eclipse, can you, anyway, I'm not.
Well, you're not mistaken, this is not visual studio,android Studio also has such a small hint, very smart and very effective, integrated Google Gods sweat AH.
What we see above is an Android IDE, in fact, Google's ambition is not limited to this, his purpose is to make it into a beyond Visual Studio, beyond Xcode's integrated development environment, where it is easy to use Git, Use SVN or other project management tools, and Google also provides cloud services:
Forget, this will not say, said more are tears, celestial look on the line.
Since it is an integrated environment, a variety of plugins are essential:
Everyone can see, basically eclipse on some plugins, here are all!
These are some of the things I've seen with Android studio this time, and I want to share with you the support of Google's pro-son, although he is only 0.6, but he can foresee that his future is limitless.
Finally attached some Android studio shortcut keys, of course, accustomed to eclipse can be set directly in the Keymap set shortcut key style for Eclipse can, see, she is like a girl, not only long good-looking, learning and good, but also sensible, gentle and kind, aged respected. How can people not be tempted!
----common shortcut keys
1.ctrl+e, you can display a list of recently edited files
2.shift+click You can close files
3. ctrl+[or] can jump to the beginning of the curly brace
4.ctrl+shift+backspace can jump to the last edited place
5.ctrl+f12, you can display the structure of the current file
6.ctrl+ F7 can query the current element's reference in the current file, and then press F3 to select
7.ctrl+n, you can quickly open the class
8.ctrl+shift+n, you can quickly open the file
9.alt+q you can see the declaration of the current method
10.ctrl+w can select a word followed by a statement followed by a function
11.alt+f1 You can locate the element you are editing in the various panels
12.ctrl+p, you can display the parameter information
13.Ctrl +shift+insert You can select the contents of the Clipboard and insert
14.alt+insert You can generate a constructor such as/getter/setter, such as
15.ctrl+alt+v can introduce variables. For example, the parentheses in the SQL into a variable
16.ctrl+alt+t can put the code inside a block, such as Try/catch
17.alt+up and Alt+down can move quickly between methods
----infrequently used shortcut keys
18. In some places, press Alt+enter to get some intention Action, for example, change "= =" to "Equals ()"
19.ctrl+shift+alt+n to quickly open symbols
20.ctrl+shift+space can give smart hints in many cases
21.ALT+F3 can quickly find
22.ctrl+/and ctrl+shift+/can annotate code
23.ctrl+alt+b can jump to the implementation of an abstract method
24.ctrl+o can choose a method of the parent class to override
25.ctrl+q can see Javadoc
26.ctrl+alt+space is the class name auto-complete
27. When opening a class/file/symbol quickly, you can use wildcards or use abbreviations
28.Live templates! Ctrl+j
29.ctrl+shift+f7 can highlight the current element's use in the current file
30.ctrl+alt+up/ctrl+alt+down can quickly jump to search results
31.ctrl+shift+j can integrate two lines
32.alt+f8 is the value of the calculated variable
Above.