Android Studio and androidstudio

Source: Internet
Author: User

Android Studio and androidstudio
Introduction to Android Studio

Android Studio is an Android development IDE recommended by Google in recent years. Compared with Eclipse, Android Studio has made various optimizations for Android development and provided a series of convenient gadgets. Next, let's try it out.


Environment:

Windows 8.1 64bit

GiONEE C605


Download and transfer

After downloading, double-click the next step.

The main aspect of adjustment is subject and font settings. All related settings are in File-> settings.



UI font is set to 14 14, and editor font is set to Consolas 16.


Real Machine Test

First, we recommend that you install a mobile phone driver on your computer. The simplest method is to connect the driver with the penguin app.

Create a test project, plug in the mobile phone, and run.




Let's take a look at the directory structure. It's a bit residential with Eclipse projects. It's best to switch to the Project mode (in the upper left corner). Let's talk about the directory one by one.




Top-level directory

1. App

The storage location, source code, and resources of application-related files.


2. idea

Some places where meta data is stored, such as the project. properties file in Eclipse.


3. build

The outermost build refers to the file generated by gradle script execution.


4. gradle
Gradle build script storage location


Detailed directory under the app


1. build
Similar to the build directory in eclipse, most of them are bytecode files generated by java.

2. libs

Similar to the build directory in eclipse, it stores the. jar file to be referenced.


3. src

Subdivided java files and resource files.


The differences with Eclipse are as follows:

1. maxcompute Studio has the concept of Project and Module. As mentioned above, a window in maxcompute Studio can only have one Project, that is, a Project, representing a workspace. However, a Project can contain multiple modules, for example, the Android Library and Java Library referenced by your project can be regarded as a Module;

2. In the preceding directory, java code and resource files (images, layout files, etc.) are all attributed to src, and there is a main group under the src directory, the java and res folders are divided at the same time. The java folder is equivalent to the src folder under Eclipse, and the res directory structure is the same.


Modular Concept

Modules are a "discrete unit of functionality that can be run, tested, and debugged independently" and are somewhat similar to an Eclipse project with a few key differences.

Each Module needs to have it's own Gradle build file (generally automatically generated for you when you create a new one, otherwise you can generate them if you are exporting a project from Eclipse ). these Gradle files contain important details such as supported Android version ranges, dependencies and other meta-data about your Android project.

Just like in Eclipse, some Modules may be "Library Modules" which are conceptually the same as "Library projects ."


You can directly create File-> create new for Modular.


Gradle

A little bit, I feel like a more flexible project configuration tool.

The content of app/build. gradle is as follows:

// Declare the Android program to apply plugin: 'com. android. application 'android {// compiled SDK compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig {// application package name applicationId "com. studiotest. river. testapplication "minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName" 1.0 "} // compilation option buildTypes {// Release compilation mode release {minifyEnabled false proguardFiles character '), 'proguard-rules. pro' }}// the package depends on dependencies {compile fileTree (dir: 'libs', include :['*. jar ']) compile 'com. android. support: appcompat-v7: 22.1.1 '}

Gradle-wrapper.properties-declares the gradle directory and download path as well as the gradle version used by the current project

#Wed Apr 10 15:27:10 PDT 2013distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

The build. gradle English comment has been clearly written. As the top-level build file, you can add compilation options for all modules, such as the minimum gradle version.

Repositories is used to declare the repository source.

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:1.2.3'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}allprojects {    repositories {        jcenter()    }}

About jcenter


JCenter is the place to find and share popular Apache Maven packages for use by Maven, Gradle, Ivy, SBT, etc.
For the most comprehensive collection of artifacts, point your Maven at: http://jcenter.bintray.com
Want to distribute your own packages through JCenter? You can link your package by clicking the "Include My Package" button.
And if you're into legacy, you can even synchronize your packages directly to Maven Central.

Reference

Android Studio series tutorial 4-Gradle basics-http://stormzhang.com/devtools/2014/12/18/android-studio-tutorial4/

Migrating From Eclipse Projects-http://tools.android.com/tech-docs/new-build-system/migrating-from-eclipse-projects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.