Android Studio Build.gradle详细配置说明

来源:互联网 发布:淘宝上门取件收费标准 编辑:程序博客网 时间:2024/04/28 16:53

http://blog.csdn.net/u011913612/article/details/51732632?locationNum=8&fps=1

    apply plugin: 'com.android.application'//说明module的类型,com.android.application为程序,com.android.library为库      android {          compileSdkVersion 22//编译的SDK版本          buildToolsVersion "22.0.1"//编译的Tools版本          defaultConfig {//默认配置              applicationId "com.nd.famlink"//应用程序的包名              minSdkVersion 8//支持的最低版本              targetSdkVersion 19//支持的目标版本              versionCode 52//版本号              versionName "3.0.1"//版本名              manifestPlaceholders = [ UMENG_CHANNEL_VALUE:"hsq" ]//声明友盟渠道名是可变的          }          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"              }          }          buildTypes {//build类型              release {//发布                  minifyEnabled true//混淆开启                  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'//指定混淆规则文件                  signingConfig signingConfigs.release//设置签名信息              }              debug {//调试                  signingConfig signingConfigs.release              }          }          packagingOptions {              exclude 'META-INF/ASL2.0'              exclude 'META-INF/LICENSE'              exclude 'META-INF/NOTICE'              exclude 'META-INF/MANIFEST.MF'          }          lintOptions {              abortOnError false//lint时候终止错误上报,防止编译的时候莫名的失败          }          //打包-渠道          productFlavors {              hsq{}              hsq_dx{}              hsq_wx{}              baidu{}              yingyongbao{}              ppzhushou{}              anzhi{}              zhushou360{}              huawei{}              lenovomm{}              wandoujia{}              mumayi{}              meizu{}              youyi{}              sougou{}          }          //打包-防渠道代码重复处理          productFlavors.all { flavor ->              flavor.manifestPlaceholders = [ UMENG_CHANNEL_VALUE:name ]          }      }      dependencies {//依赖          compile fileTree(dir: 'libs', exclude: ['android-support*.jar'], include: ['*.jar'])   //编译lib目录下的.jar文件          compile project(':Easylink')//编译附加的项目          compile project(':ImageLibrary')          compile project(':ImageResLibrary')          compile project(':Ofdmtransport')          compile project(':PullToRefreshLibrary')          compile project(':RecorderLibrary')          compile project(':WebSocket')          compile project(':WidgetLibrary')          compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'//编译来自Jcenter的第三方开源库      }  
0 0