Build.Gradle 文件解析
ONE Goal,ONE Passion!
Modle:app下—build.gradle
单个modle的配置
apply plugin: 'com.android.application' //表示是一个应用,如果是类库的话:apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2" //buildTools版本,本地必须有这个版本,如果没有的话用其他的来替换
defaultConfig {
applicationId "com.example.customview" //应用的包名
minSdkVersion 17 //最低sdk版本
targetSdkVersion 23 //目标sdk版本
versionCode 1 //当前版本号
versionName "1.0" //版本名
}
buildTypes {
release {
minifyEnabled false //是否进行混淆 false 不混淆
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//混淆文件的位置
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//引用libs包下的所有jar包
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
//引用jar包,此jar包,不在libs下.
compile 'com.github.traex.rippleeffect:library:1.2.3'
compile 'com.github.znacloud:rippleview:1.0.0'
}
Project下—build.gradle
整个项目空间的配置
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories { // 项目空间引用远程仓库--- jcenter()
jcenter()
}
dependencies {
// gradle 文件版本.
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects { // 所有的modle引用远程仓库---- jcenter()
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}