Vote, vote for http://vote.blog.csdn.net/Article/Details? Articleid = 30748339
Reprinted Please note: http://blog.csdn.net/eclipsexys/article/details/30748339
At last year's Google conference, Google brought us a small toy-Android Studio, which said it was a toy because it was indeed a dish, outdated interface, and inefficient, but now, although the version is still 0.6 or even less than 1.0, we can find that our son is a son, and now Android Studio is far from the past. It took a while to get rid of it, I think It's time to say goodbye eclipse!
This article will give you a thorough understanding of Android Studio. Note: Due to the reasons of tianchao, our understanding process will be twists and turns, but in the end we will see the dawn, then you don't want to go back to the dark!
First, download, official website address: https://developer.android.com/sdk/installing/studio.html#download
Think about it or forget it. When you open it, you can repeat several lines of code. You can download the code from some domestic traffic distribution websites. You can enjoy Baidu. this is not difficult.
This is the product!
I won't talk about installation. It's all programmers. It's not difficult, but some people may encounter installation errors:
Most of the startup failures are basically caused by JDK environment variables. When setting JDK, pay attention to adding the environment variables.
The startup process is as follows:
It is similar to Eclipse.
Select "New" or "Import" to start our project. Some gradle items will be downloaded during the first creation.
If it is a project in Eclipse, we can export it to the Android Studio format, which facilitates the import of Android Studio development.
Select "export to Gradle build file" and click "OK.
Android Studio can automatically recognize the data during Import.
This Gradle comes with a huge header. It is an integration tool that Google uses to build intelligent projects. You can use Baidu for specific purposes. In a word, he can use a line of code to complete a large string of compilation commands.
Since it is so awesome, slow down.
We can see that the memory usage is still very good, not as motionless as Eclipse.
After the first configuration, we can enter the startup interface. Here I will import an Eclipse project for Demonstration:
Let's shake it down first:
Is it really good!
However, this is hard to come by. First, we will solve the following problems:
In fact, the default Interface does not look like this. It is a bit like Eclipse. It is just a white background. First, we should first change our face:
Click Settings:
That is the small wrench, and then select appearance
Select Theme as Darcula. This is a programmer installation or eye protection. In short, it is the best choice.
To solve the problem of Chinese display, we need to set the font. We recommend that you set the font size by yourself.
Then set the font of the editing area:
Just take a name and save it as a bit to edit it.
To satisfy the needs of programmers, we need to set something, such as automatic prompts. We have to say that the automatic prompt function of Android Studio is very powerful. However, if you want to enter "String ", if you enter "string", this will not prompt, that is, it is case sensitive. Isn't it uncomfortable? Simple:
Select case insensitive! In this way, how can you prompt me!
Then there is a bit uncomfortable. People who are used to Eclipse will find that when the mouse is hovering over the program, nothing will happen! Well, right. By default, Android Studio has no mouse suspension prompt. It is also advantageous to use the shortcut key ctrl + q. Computers with poor configurations won't be stuck. But some of the nostalgia will be rejected. OK, let's change:
If you don't see it, you can check it as shown in the figure. The familiar prompt is displayed.
Some other settings, such as the row number, the number of tabs, and the format, can be found in the Editor, which is relatively simple and self-reliant.
OK. Our face has changed. Let's give it a soul.
Currently, the latest version is 0.6. If the previous version is upgraded to 0.6, you will be surprised to find that an error occurred while creating a new pj! Well, yes, I was depressed at the beginning, and I even uninstalled it N times. Finally, I will summarize how to fix this problem:
In a word, this is a sensitive word. Everyone knows that if you have money, use VPN. If you have money and no money, modify the host file. For details, refer to my previous article:
A Sigh from a programmer -- change hosts
Then we open the SDK Manager. Without an accident, we could not see the following. Unless we changed the host and used VPN, I had to spend nearly two hours here,
Finally, with the help of various resources, I happen to be right. I 'd like to share with you that I hope I will not be on the wall again!
Of course, you should check force. We all know this.
First, we need to upgrade the build tool, which is the root cause of the error!
Various errors, such:
Error: 1 0 plugin with id 'android' not found.
What else:
Error: 2 0 .............
First, we need to upgrade to 19.1.0.
Then we need to modify
Change the default value of 19.0.3 to 19.1.0 and try aging again.
So far, there will be basically no more errors. If there is an error, please wash your hands and wash your face, find a Huang daoji day and try again.
Next, let's take a look at some of the places where cool and cool are:
As you can see, compared with Eclipse, It is post-modernization. Google engineers spend a lot of time analyzing various code writing specifications and implementing it in Android Studio. How to write a piece of code is better, as you can see, the Code folding function is also pleasing to the eye.
The code prompt function is more and more perfect, which is incomparable to Eclipse.
Next, let's take a look at the most dazzling part of it. Real-time UI design features. We all know that apple has a playground which allows you to preview the effects while programming, our Android programmers have to be scared. In fact, it is just a playground after the urine is done. The current function is just for you to play, and it is not as powerful as we want, but I really want to give A thumbs up. If the programming Is really like this, it Is estimated that Every One Is A Coder.
In this version, the UI design is becoming more and more awesome. You can preview the effect while programming. Of course, it is only xml, not real-time compilation and running preview. Alas, I hope this day will come soon.
Just create an interface and don't spray me. Thank you:
The design interface is similar. Let's look at the text interface again:
Really, is it much more convenient to do the UI now, and you don't have to switch the Tab like a dumb to see the effect.
Let's look at some common functions:
New:
Why is it awesome, because it can determine the type you want to create, whether it is a java file or a resource file based on your choice, and provide various templates:
Easy to use.
Let's look at the new project:
Various templates are automatically integrated for the convenience of + 1.
Let's look at the various new templates:
Use Eclipse again. Can you do it? I can't do it anyway.
Well, you are not mistaken. This is not Visual Studio, and Android Studio has such a small tip. It is intelligent and effective. It integrates the sweat of Google's great gods.
What we have seen above is an Android development IDE. In fact, Google's ambition is not limited. His goal is to build it into a platform that surpasses Visual Studio, beyond the integrated development environment of xCode, you can easily use git, svn, or other project management tools, and Google also provides cloud services:
Forget it. If you don't want to talk about it, it's all tears. Just look at the sky.
Since it is an integrated environment, various plug-ins are indispensable:
You can see that there are basically some plug-ins in Eclipse, which are available here!
The above are some of what I saw when I used Android Studio during this time. I hope to share with you the support of Google's son. Although he is only 0.6, he is foreseeable and his future is limitless.
Finally, I attached some shortcut keys for Android Studio. Of course, if you are used to Eclipse, you can directly set the shortcut style to Eclipse in the keymap setting. Let's see, she is like a girl, it not only looks good, but also learns well, but also knows books, is gentle and kind, respect the old and love the young. How can this problem be solved!
---- Common shortcut keys
1. Ctrl + E to display the list of recently edited files
2. Shift + Click can close the file
3. Ctrl + [or] can jump to the beginning and end of braces
4. Press Ctrl + Shift + Backspace to jump to the Last edited location.
5. Press Ctrl + F12 to display the structure of the current file.
6. Ctrl + F7 can query the reference of the current element in the current file, and then press F3 to select
7. Ctrl + N to quickly open the class
8. Ctrl + Shift + N to quickly open the file
9. Alt + Q: You can see the declaration of the current method.
10. Ctrl + W can select the word and then the statement and then the row and then the Function
11. Alt + F1 can locate the elements being edited in each panel
12. Press Ctrl + P to display the parameter information.
13. Press Ctrl + Shift + Insert to select and Insert the clipboard content
14. Alt + Insert can generate Constructors/Getter/Setter, etc.
15. Ctrl + Alt + V can introduce variables. For example, assign the SQL statement in parentheses to a variable.
16. Ctrl + Alt + T can wrap the code in one piece, such as try/catch
17. Alt + Up and Alt + Down can be quickly moved between methods
---- Infrequently used shortcut keys
18. In some cases, press Alt + Enter to get some Intention actions. For example, change "=" to "equals ()"
19. Ctrl + Shift + Alt + N can quickly open the symbol
20. Ctrl + Shift + Space provides Smart prompts in many cases.
21. Alt + F3 can be quickly searched
22. Ctrl +/and Ctrl + Shift +/can comment out the code
23. Ctrl + Alt + B can jump to the implementation of the abstract Method
24. Ctrl + O you can select the parent class method for rewriting.
25. Ctrl + Q to view JavaDoc
26. Ctrl + Alt + Space is automatically completed by Class Name
27. wildcard characters or abbreviations can be used to quickly open a class/file/symbol.
28. Live Templates! Ctrl + J
29. Ctrl + Shift + F7 can highlight the use of the current element in the current file
30. Ctrl + Alt + Up/Ctrl + Alt + Down to quickly jump to the search results
31. Ctrl + Shift + J can be integrated into two rows
32. Alt + F8 is the variable value.
Above.