After a two-month as experience, I think it's time to move the Android development environment to AS. The latest version is 1.0.2, in addition to the occasional crash of UI controls (Ubuntu), where other features are still very smooth and efficient. The following are some of the features that impress me:
- Smart perception experience is good, comparable vs
- Layout preview, post-handwriting Layout preview page instantly display for easy layout adjustment and optimization
- Fast and smooth editing with no eclipse lag
- The layout or the source code has the icon and the color preview, very intuitive
- Great experience during commissioning
- Integrated terminal, like the command line operation of the partners do not have to start the terminal.
In a word, it is particularly cool to use!
Android Studio originates from the Community edition of IntelliJ Idea, and the build tool is the next-generation build tool for Gradle, plus some of the tools Google has customized for Android, so as will inevitably become the classic version of Android development tools.
Installation of Android Studio
Adnroid not go online, we can download as to other sites, and then upgrade to 1.0.2.
As to the system requirements are not low, but I i7 processor +8g memory or no pressure ah.
Windows
Microsoft? Windows? 8/7/Vista/2003 (32 or 64-bit)2 GB RAM minimum, 4 GB RAM recommended400 MB hard disk spaceAt least 1 GB for Android SDK, emulator system images, and caches1280 x 800 minimum screen resolutionJava Development Kit (JDK) 7Optional for accelerated emulator: Intel? processor with support for Intel? VT-x, Intel? EM64T (Intel? 64), and Execute Disable (XD) Bit functionality
Mac OS X
Mac? OS X? 10.8.5 or higher, up to 10.9 (Mavericks)2 GB RAM minimum, 4 GB RAM recommended400 MB hard disk spaceAt least 1 GB for Android SDK, emulator system images, and caches1280 x 800 minimum screen resolutionJava Runtime Environment (JRE) 6Java Development Kit (JDK) 7Optional for accelerated emulator: Intel? processor with support for Intel? VT-x, Intel? EM64T (Intel? 64), and Execute Disable (XD) Bit functionality
On Mac OS, run Android Studio with Java Runtime Environment (JRE) 6 for optimized font rendering. You can then configure your project to use Java development Kit (JDK) 6 or JDK 7.
Linux
GNOME or KDE desktopGNU C Library (glibc) 2.11 or later2 GB RAM minimum, 4 GB RAM recommended400 MB hard disk spaceAt least 1 GB for Android SDK, emulator system images, and caches1280 x 800 minimum screen resolutionOracle? Java Development Kit (JDK) 7
After downloading, unzip it to the path you specified. I worked under Ubuntu and put it directly under the/opt. After extracting the content as follows:
android-studio3$ lsbin build.txt gradle Install-Linux-tar.txt lib license LICENSE.txt NOTICE.txt plugins
It is worth saying that Gradle is here, we can use Gradle to do simple compiling work. First, we're going to execute the studio.sh start as in the bin, as we said in Install-linux-tar.txt, we can put this bin directory in the system variable and start as just enter studio.sh. For example, I added the following in. BASHRC:
export PATH="$PATH:/opt/android-studio3/bin"export PATH="$PATH:/opt/android-studio3/gradle/gradle-2.2.1/bin"
The first boot will detect the SDK and upgrade to the latest, if not the agent, this step we can not pass, as will not start success. The solution is to have their own Adnroid SDK manager to the domestic mirror, please refer to the "Android combat Skills nine: The latest Android development environment (Eclipse+adt+android 5.0)", after the successful upgrade, as will successfully start. The next thing is simple, the interface is clear, just like you do with other Ides, get started quickly. However, the results of the project vary greatly (compared to eclipse), the shortcut key changes are also very large, to adapt to a period of time. Download a copy of the Keymap print out, use it to see, will quickly enter the state.
Tips:
After opening the project, modify the SDK and JDK path, set as follows: File–>other Settings–>default Project Structure
If you like the theme of black style, then switching to the vampire Darcula theme is a good choice: file–>settings–>appearance–>theme
Gradle
There are two build.gradle files in the project, as follows:
$ find -name build.gradle./app/build.gradle./build.gradle
The Build.gradle in the project root directory is only a commen configuration, and the Build.gradle under the app is a more granular configuration for this app:
Apply plugin:' Com.android.application 'Android {Compilesdkversion +Buildtoolsversion"21.1.2"Defaultconfig {ApplicationID"Com.linc.arrowfall"Minsdkversion -Targetsdkversion +Versioncode1Versionname"1.0"} buildtypes {release {minifyenabledfalseProguardfiles Getdefaultproguardfile (' Proguard-android.txt '),' Proguard-rules.pro '}}}dependencies {Compile Filetree (dir:' Libs ', include: [' *.jar ']) Compile' com.android.support:appcompat-v7:21.0.3 '}
When you make Project (CTRL+F9), the following information is printed in the lower-right corner of Gradle console:
Executing tasks: [: App:compiledebugsources]configuration On Demand are an incubating feature.: App:prebuild: App:predebugbuild: App:checkdebugmanifest: App:prereleasebuild: App:preparecomandroidsupportappcompatv72103libraryUp-to-date: App:preparecomandroidsupportsupportv42103libraryUp-to-date: App:preparedebugdependencies: App:compiledebugaidlUp-to-date: App:compiledebugrenderscriptUp-to-date: App:generatedebugbuildconfigUp-to-date: App:generatedebugassetsUp-to-date: App:mergedebugassetsUp-to-date: App:generatedebugresvaluesUp-to-date: App:generatedebugresourcesUp-to-date: App:mergedebugresourcesUp-to-date: App:processdebugmanifestUp-to-date: App:processdebugresourcesUp-to-date: App:generatedebugsourcesUp-to-date: App:compiledebugjava: App:compiledebugndk: App:compiledebugsourcesBUILD successfultotal time:10.23 secs
Let's start with the gradle in as, we'll start with the Gradle command line. Just mentioned the Gradle path that comes with the as in the Android-studio3/gradle/gradle-2.2.1/bin, add it to the environment variable (above), so that you can use the Gradle tool in the location. Here's the simplest use of gradle:
$ gradle -v------------------------------------------------------------Gradle 2.2.1------------------------------------------------------------Build time: 2014-11-24 09:45:35 UTCBuild number: noneRevision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4aGroovy: 2.3.6Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013JVM: 1.7.0_71 (Oracle Corporation 24.71-b01)OS: Linux 3.13.0-45-generic amd64
Gradle is working properly, here's a Hello world. Create a new Build.gradle file and add the following code:
task helloworld << { ‘hello world‘}
This task outputs only one log and executes the following command:
$ gradle -q helloworldhello world
The parameter-q just prints the log, and this task is the function.
Execute Gradle–gui in this directory, bring up the gradle of the graphical interface, and see HelloWorld's other information.
Compiling Java programs
Now try to compile one of the simplest Java programs, creating new directories and files in the directory just below:
$ mkdir -p src/main/java/com/linc; vim src/main/java/com/linc/HelloWorld.java
In the code as follows:
package com.linc;publicclass HelloWorld { publicstaticvoidmain(String args[]) { System.out.println("hello, world"); }}
Build.gradle files with the SRC directory at the same peer, such as only one line:
‘java‘
Run gradle buildat this point:
$ gradle build:compileJava:processResources UP-TO-DATE:classes:jar:assemble:compileTestJava UP-TO-DATE:processTestResources UP-TO-DATE:testClasses UP-TO-DATE:test UP-TO-DATE:check UP-TO-DATEtime2.206 secs
The directory structure at this point becomes as follows:
6.├── build│ ├── classes│ │ └── main│ │ com│ │ └── linc│ │ └── HelloWorld.class│ ├── dependency-cache│ ├── libs│ │ └── helloworld.jar│ └── tmp│ ├── compileJava│ └── jar│ └── MANIFEST.MF├── HelloWorld.java└── src └── main └── java com └── linc └── HelloWorld.java
Run the compiled Java program:
$ java -cpcom.linc.HelloWorldhello, world
The first experience of Gradle is here, and more complex building tasks are still to come. With the powerful tools of AS, Android development will become more and more fun!
Reference:
Http://www.gradle.org/documentation
http://www.android-studio.org/index.php/88-download/
Android Combat Skills Xi.: Android Studio and Gradle