Android_studio precautions for use
1,as can use the Eclipse SDK, But it cannot be shared ( the latest SDK Eclipse is not supported , so the SDK has been updated as later , Eclipse you can't use it. )
2, recommended to use the extracted version of as,as c disk user Directory . If it's an uncompressed version of delete the corresponding profile directory is quite a reinstall of ( So the unzipped version of the folder can be copied directly to others , Don't worry about configuring
3, If the first open crash , find idea.properties last append disable.android.first.run= True ( no initialization step ), Avoid connecting Google server update SDK
4, directory structure
Two tiers : The name you specified when you created the project , like Eclipse the workspace name in
Small layer : Module, similar to small projects in Eclipse Project
① default is Android view : manifest file + Java code + resource file , Gradle
② can be switched to hard drive view (Project)
App>>src>> Code , resource Files , manifest files , will be edited everything is here
Libs to put extra jar Packages
The green . gradle suffix file ( folder not included ) is important
Other folders or files can be deleted , do not affect the program run ( will be automatically generated , So in version control should pay attention to the filter , Temporary )
Each Module corresponds to a gradle, the whole project also corresponds to a gradle, It is inside each one Module
build>>outputs>> stored in Module with apk
Build>>source>>r>>xxx r File here
Copy the source of the time to remember to delete the build folder , It is similar to a cache directory , occupy a large space .
5, You can search directly in the directory of the corresponding files ( no search box , but can search directly )
6,android Studio 2.0 new features
Instant run immediately After the initial deployment of an application to a real device or emulator, the immediate run pushes most of the changed code or resources without having to build a new APK .
However, this new feature is still a BUG , the modification of the layout file will immediately push the modified code , but modify the Java Sometimes the code will not succeed , if not successful, you can turn off the Instant Run and then turn it back on .
If the re- opening is not valid, restart the Studio
The essence is to continually submit data to the simulator by keeping a stream
7, modify common Settings ( all in Setting can find Ctrl + AIT + s)
Updates settings > can select the stable version (Stable Channel) to work with or Canary channel ( try out new features with beta version when studying
The bar in the code is a suggested line of code do not exceed here
Display whitespace characters , do not use the tab key in the work, use the SPACEBAR , but as Representative 4 a
Automatic Guide Package : Optimize imports on fly and its options below ( If there are multiple packages , It will not automatically guide the package )
Code completion : First letter case sensitive completion
ait+/ tip : find shortcut keys keymap>>completion>> Modify Basic The default shortcut key
Eclipse 's keying mapping is not recommended because everyone is accustomed to different , so it is still possible to use the default .
9, common shortcut keys :
Ctrl + f12// member variables and jump for member methods
ctrl+n// class Jump
Shift Double-click // any jump , XML file , toolbar can be used to jump
f2// jump to the next error line
ctrl+p// parameter Hints
ctrl+q// Viewing document comments
ait+enter// automatically fix code errors
ctrl+alt+l// Formatting
ctrl+d// Copy Selected rows
ctrl+y// Delete this line
ctrl+x// clip without selecting a row
ctrl+ait+o// automatic deletion of unused packages
alt+insert// automatic generation of common methods , such as the get,set method
ctrl+o// The method of the parent class , does not automatically fill in the code
Ten, templates >> settings>>file and Code Templates
Some companies will explain the modification record in the class document comment
Fbc>> One-click to find id>> automatically identifies the control type
Android provides a lot of useful code templates , Nothing to look at
One, custom code templates
Settings>>live>> do not create a new code template directly , create a new code group
For example : LOG.E (Tag,"$cname $. $nnmae $, $msg $");// Remember to set the context
$$ refers to a variable , the name is random , You can edit the specified name , by the cursor will occupy ( Enter to jump to the next )
Install the plugin
①MarkDown plugin //md documentation , embarrassing , taking notes
②wifiadb
the use of Debug
Next , Enter method , Force entry Method ( lack of source code ), jump Out of method
Unit Test
Project Test package , androidtest can be tested with the class of the context , the normal test You can test the normal class
Sout shortcut key >>system.out.print
The test package here is not packaged in the APK
the role of 15,gradle
Settings.gradle Declaration Project all modules represent that the package is in use , cannot be removed , and can play a protective role
Project Builde.gradle jcenter ()// source repository , if the download jar package always fails , Replace mavencentral ()
The builde.gradle of the app is stored in the compiled information : compiled version , Buildtools
If someone else's app uses a different version of buildtools , You can choose to modify it here , or download the corresponding version .
:p roguardfiles confusing file locations under the buildtypes node
Dependencies node is dependent information , the configuration of the external reference jar Package
16. Importing third-party jar Packages
Project structure>>app>>depentcies>> can search for third-party dependent packages ( such as xtuils) from the server
When using The AS Project , If you delete some resource files , re-import can
Import the eclispse project , do not modify the options , will automatically convert eclipse Project
Import the project using the Eclipse directory structure
ADT23, the latest version of ADT more than one feature , Export can be exported to generate Gradle mode files
The
generated build. Gradle file , gradle version Span style= "FONT-FAMILY:CALIBRI;" >, auto-generated very old
Delete the Gradle folder ( the Gradle version in the configuration file is older , Delete , download is available )
Android Studio Notes