关于build.gradle配置文件详细参数讲解

项目级别的build.gradle一般无须改动,我们只需关注模块级别的build.gradle。下面就自己记一下build.gradle中的参数用途吧。

android {
    compileSdkVersion 25
    //指定编译用的SDK版本号,如25表示使用Androd7.1编译
    buildToolsVesion"25.0.2"
    //指定编译工具的版本号,这里的头两位数字必须与compleSdkVersion保持一致,具体的版本号可在sdk安装目录的sdk/buile-tools下找到
    defaultConfig {
        applicationId "com.example.helloworld.liaotianshi"
        //指定该模块的应用编号,即App的包名,该参数为自动生成,无须修改
        minSdkVersion 15
        //指定APP适合运行的最小SDK版本号,如15表示至少要在Android4.0.3上运行
        targetSdkVersion 28
        //指定目标设备的SDK版本号,即该APP最希望在那个版本的Android上运行
        versionCode 1
        //指定APP的应用版本号
        versionName "1.0"
        //指定APP的应用版本名称
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            //指定是否开启代码混淆功能,true表示开启混淆,false表示无须混淆。
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            //指定代码混淆规则文件的文件名
        }
    }
}

dependencies {
//指定APP编译的依赖信息
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    //指定引用jar包的路径
    testImplementation 'junit:junit:4.12'
    //指定单元测试编译用的junit版本号
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

 

你可能感兴趣的:(Android,Android,Studio,buile.gradle,android)