学考乐离线App
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. plugins {
  2. id 'com.android.application'
  3. id 'kotlin-android'
  4. }
  5. android {
  6. compileSdk rootProject.ext.compile_sdk_version
  7. defaultConfig {
  8. applicationId "com.xkl.cdl"
  9. minSdk 21
  10. targetSdk 30
  11. versionCode 1
  12. versionName "1.0"
  13. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  14. }
  15. /*构建类型: 定义Gradle在构建阶段和打包应用时使用的某些属性*/
  16. buildTypes {
  17. release {
  18. minifyEnabled false
  19. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  20. }
  21. }
  22. //配置产品变种 与 构建变体
  23. //flavorDimensions :变种维度
  24. flavorDimensions "version"
  25. productFlavors{ //产品变种
  26. demo{
  27. dimension "version"
  28. //applicationId后追加 .demo 也可以重新定义applicationId 属性
  29. applicationIdSuffix ".demo"
  30. versionNameSuffix "-demo"
  31. }
  32. full {
  33. dimension "version"
  34. applicationIdSuffix ".full"
  35. versionNameSuffix '-full'
  36. }
  37. }
  38. //变体过滤器
  39. variantFilter { variant ->
  40. def names = variant.flavors*.name
  41. if (name.contains("demo")){
  42. setIgnore(true)
  43. }
  44. }
  45. compileOptions {
  46. sourceCompatibility JavaVersion.VERSION_1_8
  47. targetCompatibility JavaVersion.VERSION_1_8
  48. }
  49. kotlinOptions {
  50. jvmTarget = '1.8'
  51. }
  52. buildFeatures {
  53. viewBinding true
  54. }
  55. }
  56. dependencies {
  57. implementation 'androidx.core:core-ktx:1.3.2'
  58. implementation 'androidx.appcompat:appcompat:1.2.0'
  59. implementation 'com.google.android.material:material:1.3.0'
  60. testImplementation 'junit:junit:4.+'
  61. androidTestImplementation 'androidx.test.ext:junit:1.1.2'
  62. androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
  63. }