为了简化 Android 的开发力度,Google 决定将重点建设 Android Studio 工具。Google 会在今年年末中止支持其它集成开发环境。比方 Eclipse。java
Android Studio 是第一个官方的 Android 开发环境。android
其它工具,好比 Eclipse。在 Android Studio 公布以前已经有了大规模的使用。为了帮助开发人员转向 Android Studio,谷歌已经写出一套迁移指南。android-studio
详细内容可到http://android-studio.org/查看app
本文为当中常常使用功能介绍篇:maven
android application module 会显示一个手机图标(下图中的 app );android library module 会显示一个书架图标(下图中的 android-lib);java library module 会显示一个咖啡图标(下图中的 java-lib )。
ide
功能相似于 Eclipse 中的 Logcat ,但是比其多了一些常常使用功能。好比:截图,查看系统信息等。工具
Gradle 任务列表。双击可运行 Gradle 任务。布局
常常使用任务: build 、 clean 、 assemble 、assembleRelease 、 assembleDebug 、 lint 。gradle
经过点击可以进行切换。
ui
解说5
做用和命令行一下,你可以在这里运行一些命令行命令。
解说7
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
maven {
url "http://xx.xxx.xxx/xxx"
}
http://maven.oschina.net/content/groups/public/
http://maven.oschina.net/content/repositories/thirdparty/
Gradle 会依据依赖定义的顺序在各个库里寻找它们。在第一个库里找到就不会再在第二个库里进行寻找。
include ':app'
include ':app2'
project(':app2').projectDir = new File('path/to/app2')
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "cc.bb.aa.myapplication"
minSdkVersion 10
targetSdkVersion 21
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:21.0.3'
}
com.android.library 表示,这是一个 android library module 。
默认有两个: release 和 debug 。
咱们可以在此处加入本身的 buildTypes 。可在 Build Variants 面板看到(见 解说1 )。
在老版本号中为 runProguard ,新版本号之所换名称,是因为新版本号支持去掉没使用到的资源文件,而 runProguard 这个名称已不合适了。
2. **proguardFiles**:
使用的混淆文件。可以使用多个混淆文件。此例中。使用了 **SDK** 中的 **proguard-android.txt** 文件以及当前 **module** 文件夹下的 **proguard-rules.pro** 文件。
点击 Checkout from Version Control,选择server的版本号控制工具。填写地址就能够迁出。