爲了簡化 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的版本號控制工具。填寫地址就能夠遷出。