1. Download Android Studio
If you already have Eclipse installed and you already have the Android SDK installed, please only lower the android Studio IDE only,:http://tools.android.com/download/studio/canary/1-3-1.
Convenient for everyone to download, attached to Baidu Network disk link, is the version of Windows, click to open the link.
2, then execute the download completed EXE file, always press Next, you can install Android Studio finished.
In the process I encountered a problem: for example, the SDK does not install android-23,android Studio will automatically download my not installed android-23 this version, but in this version of the SDK, I have some are not downloaded, even if the wall has been turned, We can configure let Android studio not go automatically download the rest of the SDK version, refer to Android Studio first launch fetching Android SDK component information issue.
3. Modify Font Size
Use CTRL + ALT + S to summon the Setings dialog box. or click on the toolbar to call out the Setting dialog box, find Editor->colors & Fonts->font, because the default theme cannot be modified size, so we want to use Sava as to recreate a theme, You can then set the size.
4, we have modified the size of the font, has not modified the left engineering directory structure font size, modified by appearance & behavior appearance, and then click Override Defautl Fonts by, Then you can set the size.
5, display line number editor->appearance->show lines numbers, click Select.
6, modify the shortcut key for Eclipse, keymap->keymaps select as Eclipse.
7, modify the automatic prompt, the default installation of Android Studio, code hints are like this, if the input intent, then the uppercase intent is not displayed, then how do not distinguish the size hint?
Editor->general->code completion, select None.
8. Add jar package to Android Studio
(1), Click the project Catalog right, select Project Structure, select Dependencies, click the plus sign, and then select Library dependency, you can select the jar package to add, and then Android Studio will download it in Jcenter's warehouse.
we see com.android.support.appcompat-v7:22.2.1 is not very familiar where has appeared, yes, in the app directory of Build.gradle inside there, whenever the add Library Dependency will add an item in the Build.gradle, currently we can also be configured in Build.gradle , Android Studio will also go jcenter automatic download, so as to facilitate the update version number.
The added jar package will appear in the bottom external Libraries .
Build.gradle in the app directory:
Apply plugin: ' Com.android.application ' android { compilesdkversion buildtoolsversion "22.0.1" defaultconfig { ApplicationID "Com.example.youku.helloworld" minsdkversion targetsdkversion Versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false Proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro ' } }}dependencies { Compile Filetree (dir: ' Libs ', include: [' *.jar ']) compile ' com.android.support:appcompat-v7:22.2.1 '}
so we come to a conclusion the properties Signing flavors Build Types dependences correspond to the Build.gradle in the app directory.
(2), refer to the entire project structure diagram, directly add the jar package to the app directory libs, you can use the jar package, this is why? We see the build.gradle of the app directory with the following code:
dependencies { Compile filetree (dir: ' Libs ', include: [' *.jar '])//This is the key, the Libs of the jar package is also built through Gradle compile ' com.android.support:appcompat-v7:22.2.1 '}
9, Android Studio Add dependent project, and the same as above, just choose module dependency here.
After the successful addition, add a line in the app directory Build.gradle, as follows:
dependencies { Compile filetree (dir: ' Libs ', include: [' *.jar '])//This is the key, the Libs of the jar package is also built through Gradle compile ' com.android.support:appcompat-v7:22.2.1 ' Compile project (': AppCenter ')//Add this line, we look at the prefix is Project}
10, Android Studio add so. To create a new jnilibs in the Src/main directory, the default so file should be placed in this directory.
If you do not want to put in this directory, such as want to put in and Libs sibling directory of Jnilibs, how to do? The answer is to modify the Build.gradle in the app directory, plus the following code:
Sourcesets { main { jnilibs.srcdirs = [' Jnilibs '] }
11, detailed application directory under the Build.gradle and Engineering directory under the Build.gradle parameters
App directory under Build.gradle, as follows:
Apply plugin: ' com.android.application '//Mark this is an application, not a library, if it is a library, then apply plugin: ' Com.android.library ' Android { Compilesdkversion//SDK version number, is the project catalog external libraries Android.jar version number buildtoolsversion "22.0.1"// The version number of the tool compiled by the SDK, Gradle is just the build tool, and eventually the SDK Buildtools to compile defaultconfig { ApplicationID " Com.example.youku.helloworld "//Package name minsdkversion 15// The following are not defined in the Androidmanifest.xml, Gradle is built with this information in Androidmanifest.xml targetsdkversion versioncode 1 Versionname "1.0" } Buildtypes { Release { minifyenabled false//Do not use confusion proguardfiles getdefaultproguardfile (' Proguard-android.txt '), ' proguard-rules.pro '//Obfuscation rule location } }}dependencies { compile filetree (dir: ' Libs ', include: [' *.jar '])//libs inside the jar package will be built in compile ' com.android.support:appcompat-v7:22.2.1 '//referenced third-party JAR package}
project directory under Build.gradle:
Top-level build file where can add configuration options common to all Sub-projects/modules.buildscript { repos itories { jcenter ()//download Gradle plugin's Warehouse } dependencies { classpath ' Com.android.tools.build:gradle : 1.3.0 '//gradle plug-in version number, not gradle version number /Note:do not place your application dependencies here; they belong //in th E individual module Build.gradle files }}allprojects { repositories { jcenter ()//download warehouse for third party jar packages }}
12, Gradlew.bat and Gradle-wrapper
Gradle-wrapper.properties, as follows:
#Thu Sep 10:00:04 CST 2015distributionbase=gradle_user_homedistributionpath=wrapper/distszipstorebase=gradle_ User_homezipstorepath=wrapper/distsdistributionurl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
Gradlew.bat first through the gradlew-wrapper inside the Gradle version number, here is Gradle-2.4-all, find the corresponding Gradle command, and then through this command to execute. So why not just put the gradle command in the environment variable? Because the version of Gradle changes frequently, it is inconvenient to change the environment variable every time. Here you only need to modifyThe version number of the Gradle-wrapper.properties is available.
So where exactly is Gradle-2.4-all?
If this directory does not have Gradle-2.4-all.zip, first will go to download gradle-2.4-all.zip, because this file download is slower, so we from Http://pan.baidu.com/s/1pJwzxhT, after the download is complete, then put it in this directory and Android studio will automatically unzip the zip.
Hint: If Android studio already has gradle2.4, also to download gradle, please change gradle-wrapper.properties to Gradle-2.4-all, will not go to download automatically.
13, we often click this button, Sync Projects with Gradle Files
This button is to check that the Gradle build has no syntax errors.
Using Gradlew.bat Clean is to clear the APK from the app directory build. Using Gradlew.bat build is the build apk, at which the APK is generated as follows:
The Dubug version is signed with the certificate of Debug. Release version has no signature (unsigned).
14, generate the Get Set ToString method, in the code right click Generate. Another useful is to click on the right button to select Refactor.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
From beginning to end Android Studio