build.gradle註釋

 

apply plugin: 'com.android.application'

android {
    //指定編譯用的SDK版本號。如28表示使用Android 9.0編譯
    compileSdkVersion 28

    defaultConfig {
        //指定該模塊的應用編號,即APP的包名  該參數自動生成,無須修改
        applicationId "com.example.administrator.helloworld"
        //指定App運行適合運行的最小SDK版本號  如15表示至少要Android 4.1 上運行
        minSdkVersion 15
        //指定目標設備的SDK版本號  即該App最希望在哪個版本的Android 上運行
        targetSdkVersion 29
        //指定App的應用版本號
        versionCode 1
        //指定App的應用版本名稱
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            //指定是否開啓代碼混淆功能 true表示開啓混淆,false表示無須混淆
            minifyEnabled false
            //指定代碼混淆規則文件的文件名
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

//指定App編譯的依賴信息
dependencies {
    //指定引用jar包的路徑
    implementation fileTree(dir: 'libs', include: ['*.jar'])
	 //指定編譯Android的高版本支持庫  如AppCompatActivity必須指定編譯appcompat-v7庫 
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
	//指定單元測試用的junit版本號
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}


implementation 'com.android.support:appcompat-v7:28.0.0必須要根據支持庫的實際版本號,否則會報錯

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章