build.gradle的模块级

2020-02-08  本文已影响0人  士心禾斗

/**

apply plugin: 'com.android.application'

/**
*开始配置安卓特定的编译选项
*/

android {

/**

compileSdkVersion 25
buildToolsVersion "25.0.0"

/**

defaultConfig {

/**
 * applicationId 应用的名字
 * 但是代码中的包名仍然参考main/AndroidManifest.xml
 */

applicationId 'com.example.myapp'

// 定义运行的最小系统版本
minSdkVersion 15

// 执行运行的api版本,通常和compileSdkVersion一致
targetSdkVersion 25

// 定义应用的版本
versionCode 1

// 定义对用户的版本
versionName "1.0"

}

/**

buildTypes {

/**
 * 默认情况下,Android Studio 对release编译类型进行了配置,
 * minifyEnabled减少应用的体积,并且指定了混淆设置文件
 */

release {
    minifyEnabled true // Enables code shrinking for the release build type.
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

}

/**

productFlavors {
free {
applicationId 'com.example.myapp.free'
}

paid {
  applicationId 'com.example.myapp.paid'
}

}

/**

*/

splits {
// Screen density split settings
density {

  // Enable or disable the density split mechanism
  enable false

  // Exclude these densities from splits
  exclude "ldpi", "tvdpi", "xxxhdpi", "400dpi", "560dpi"
}

}
}

/**

dependencies {
compile project(":lib")
compile 'com.android.support:appcompat-v7:25.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

上一篇 下一篇

猜你喜欢

热点阅读