Build.gradle 詳細配置說明


apply plugin: 'com.android.application' //說明 module 的類型,com.android.application 為程序
 
android {
    compileSdkVersion    22 //編譯的SDK版本
    buildToolsVersion    "22.0.1" //編譯的 Tools 版本
    defaultConfig {  //默認配置
        applicationId    "com.nd.famlink" //應用程序的包名
        minSdkVersion     8  //支持的最低版本
        targetSdkVersion  19  //支持的目標版本
        versionCode    3  //版本號
        versionName    "3.0.1"  //版本名
    }
 
    sourceSets {  //目錄指向配置
        main {
            manifest.srcFile  'AndroidManifest.xml'  //指定 AndroidManifest 文件
            java.srcDirs = ['src']  //指定 source 目錄
            resources.srcDirs = ['src']  //指定 source 目錄
            aidl.srcDirs = ['src']  //指定 source 目錄
            renderscript.srcDirs = ['src']  //指定 source 目錄
            res.srcDirs = ['res']  //指定資源目錄
            assets.srcDirs = ['assets']  //指定 assets 目錄
            jniLibs.srcDirs = ['libs']  //指定 lib 庫目錄
        }
        debug.setRoot('build-types/debug')  //指定 debug 模式的路徑
        release.setRoot('build-types/release')  //指定 release 模式的路徑
    }
 
    signingConfigs {  //簽名配置
        release {  //發布版本簽名配置
            storeFile file("fk.keystore")  //密鑰文件路徑
            storePassword  "123"  //密鑰文件密碼
            keyAlias  "fk"  //key 別名
            keyPassword  "123"  //key 密碼
        }
        debug {  //debug版本簽名配置
            storeFile file("fk.keystore")  
            storePassword  "123"
            keyAlias  "fk"
            keyPassword  "123"
        }
    }
 
    buildType {  // build 類型
        release {  //發布
            minifyEnabled  true  //混淆開啟
            proguardFiles  getDefaultProguardFile('proguard-android.txt'),'proguard-android.txt'  //指定混淆規則文件
            signingConfig   signingConfigs.release  //設置簽名信息
        }
        debug {  //調試
            signingConfig signingConfigs.release
        }
    }
 
    lintOptions {
        abortOnError   false  // lint 時候終止錯誤上報,防止編譯的時候莫名的失敗
    }
}
 
dependencies  {
     compile  fileTree(include: ['*.jar'], dir: 'libs')  //編譯lib 目錄下的 jar 文件
    compile  project(':Easylink')  //編譯附加的項目
 
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.jakewharton:butterknife:8.4.0'  //編譯第三方開源庫
 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM