学考乐离线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 2.2KB

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