从2015年下半年开始,Google为了简化Android的开发工作,不再支持对Eclipse等开发工具的更新,主推由Google开发的AndroidStudio开发工具。 到目前为止,相信还有不少的Android开发同行使用的Eclispe做为开发工具,为了顺序潮流,为了更方便地开发出高效的Android应用,我们应该尽快从 Eclipse上转移到AndroidStudio开发工具上来。从去年9月份开始用AndroidStudio开发工具到现在已经半年有余了,把工作中用到的以及在网上学 习到的一些AndroidStudio的使用方法总结一下。希望可以给朋友们一点点小三用。首先我们在电脑上安装好jdk开发工具,配置好jdk环境变量,然后就可以下载AndroidStudio开始我们的开发之旅。首先从哪里可以下载AndroidStudiO开发工具呢?目前我个人常用的这三个网站都可以下载。
1,android Development Website: http://developer.android.com/index.html. Official website in the domestic network environment access is indeed a problem, can be through the wall or VPN agent download. The
can also be downloaded from the following two URLs without flipping the wall.
2,http://www.androiddevtools.cn/. This site collects the Android SDK needed for Android development, tools used in development, Android development tutorials, Android design specifications, free design materials, and more. Information is complete, personally feel very helpful.
3,androidstudio Chinese Community: http://www.android-studio.org/, this site can not only download development tools, but also androidstudio User Guide and other practical knowledge.
After the download is complete, click on the Androidstudio folder under the extracted. exe installation file under the Bin folder to install the Androidstudio.
The first installation is a bit time-consuming, please wait patiently. When the first installation succeeds, a pop-up using the prompt box
After the installation is complete, we can create a new Android project. Open the Androidstudio main interface to see several options for creating a project: You can create a new project directly, you can export from a version control library, or you can import an Eclipse project (which makes the Eclipse project Androidstudio very convenient), and so on.
First we view or modify configuration information such as JDK and SDK in Androidstudio to open the relevant interface:
Now we view the directory structure of the project in Androidstudio:
The Androidstuio project contains concepts such as project and module. You can create multiple module in one project, which is equivalent to one project in our Eclipse project that can add multiple Libray projects.
Create Modlue
Delete the module file operation in the project:
Other common settings can refer to blog posts. http://blog.csdn.net/true100/article/details/50163429
* * nasty divider line ***********************
Shortcut keys to use:
The code moves up and down: ctrl+shift+ (down) cursor key
Copy Current Line code: CTRL+D
Code Cut: Ctrl+x
Code Delete: Ctrl+y
Code Return action: ALT + cursor LEFT arrow
Cursors move between methods in a class (Find methods in a Class): Alt
Open a file operation: Ctrl+shift+n
View (find) A class file: Ctrl + N
See where a variable is used: ctrl+b
To view the parent class of a class: Ctrl+u
See where a method is called: ctrl+alt+h
View the implementation of a method in a class (all the code for the Popup View method): Ctrl+shitf+i
Show class structure diagram: Ctrl+h
Code expansion or collapse operation: Ctrl+plus/mimus (plus/decrease)
Code format operation: ctrl+shift+l
Open a recently opened document: Ctrl+e
Highlight warning or error code quick location: F2
Find a variable or method in a class: Ctrl+shitf+alt+n
Text Lookup operation: ctrl+f
Text substitution operation: ctrl+r
Display the code structure of the class: Ctrl+f12
Code hint action: ctrl+alt+ space key
Select multiple lines of code action: Ctrl+w
Returns the previous or next open Window action: ALT + cursor LEFT or RIGHT arrow
* * nasty divider line ***********************
Androidstudio also provides us with shortcut code generation shortcuts, which makes it easier to write some common code:
CTRL+J combination: You can quickly generate If,if-else,for,try-catch,toast,findviewbyid and other commonly used shortcut code.
Tips for debugging code in development:
1, print log log quick action
Tag tag for generating log log: Logt
Print the corresponding level log log: LOGD,LOGI,LOGE,LOGM, etc.
2. Breakpoint Debugging method
First, click the breakpoint on the left side of the line where you want to break the point, and then:
Single-Step Debugging: F8
Entry method Internal: F7
Go to the next breakpoint: Shitf+f8
When debugging, the breakpoint at the right-click, you can observe the value of the variable, you can also modify the value of the variable, in the console out of the log statement and so on.
Finally in use, there is a small problem, such as we write TextView Tv=findviewbyid ...., will prompt you not to import TextView corresponding package, let you press the Alt+enter key, in fact, we can also set the project automatically import the corresponding package file function:
The two options in the Red box on the graph are shown on the hook. First introduced here, you are welcome to correct me.
Quick use of Androidstudio development tools