build.gradle 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. plugins {
  2. id 'com.android.application'
  3. id 'org.jetbrains.kotlin.android'
  4. }
  5. apply plugin: 'kotlin-kapt'
  6. android {
  7. compileSdk 32
  8. defaultConfig {
  9. applicationId "com.xplora.commonservice"
  10. minSdk 27
  11. targetSdk 32
  12. versionCode 1
  13. versionName "1.0"
  14. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  15. }
  16. buildFeatures {
  17. viewBinding = true
  18. buildConfig = true
  19. }
  20. buildTypes {
  21. debug {
  22. minifyEnabled false
  23. zipAlignEnabled false
  24. shrinkResources false
  25. buildConfigField "boolean", "LOGGER_DEBUG", "true"
  26. }
  27. release {
  28. buildConfigField "boolean", "LOGGER_DEBUG", "false"
  29. minifyEnabled true
  30. zipAlignEnabled true
  31. shrinkResources true
  32. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  33. }
  34. }
  35. kapt {
  36. arguments {
  37. arg("room.schemaLocation", "$projectDir/schemas".toString())
  38. }
  39. }
  40. packagingOptions {
  41. resources {
  42. excludes += ['META-INF/DEPENDENCIES']
  43. }
  44. }
  45. compileOptions {
  46. sourceCompatibility JavaVersion.VERSION_17
  47. targetCompatibility JavaVersion.VERSION_17
  48. }
  49. namespace 'com.xplora.commonservice'
  50. lint {
  51. baseline = file("lint-baseline.xml")
  52. }
  53. applicationVariants.all { variant ->
  54. def outputFileDir = "..\\"
  55. variant.outputs.all {
  56. def fileName = outputFile.name.replace(outputFile.name, "XPCommonService.apk")
  57. outputFileName = fileName
  58. }
  59. variant.getAssembleProvider().configure() {
  60. it..doLast {
  61. File out = new File(outputFileDir)
  62. copy {
  63. variant.outputs.forEach { output ->
  64. copy {
  65. from output.outputFile
  66. into out
  67. }
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }
  74. //Add this to get SystemProperties
  75. String SDK_DIR = System.getenv("ANDROID_SDK_HOME")
  76. if (SDK_DIR == null) {
  77. Properties properties = new Properties()
  78. properties.load(new FileInputStream(project.rootProject.file("local.properties")))
  79. SDK_DIR = properties.get('sdk.dir')
  80. }
  81. //Add this to get SystemProperties end
  82. dependencies {
  83. implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
  84. implementation 'com.google.android.material:material:1.4.0'
  85. implementation 'androidx.appcompat:appcompat:1.4.2'
  86. implementation 'androidx.core:core-ktx:1.7.0'
  87. implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  88. implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
  89. implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
  90. implementation 'androidx.activity:activity-ktx:1.4.0'
  91. implementation 'androidx.fragment:fragment-ktx:1.4.1'
  92. implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  93. implementation project(path: ':libaws-mqtt-android')
  94. testImplementation 'junit:junit:4.13.2'
  95. androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  96. androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  97. //retrofit
  98. implementation 'com.squareup.retrofit2:retrofit:2.9.0'
  99. implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
  100. implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
  101. implementation 'com.squareup.retrofit2:retrofit-converters:2.5.0'
  102. implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.10'
  103. implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
  104. implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
  105. //gson
  106. implementation 'com.google.code.gson:gson:2.9.0'
  107. //kotlin coroutines
  108. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"
  109. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0"
  110. //room
  111. def roomVersion = "2.4.2"
  112. implementation("androidx.room:room-runtime:$roomVersion")
  113. // annotationProcessor("androidx.room:room-compiler:$roomVersion")
  114. implementation("androidx.room:room-ktx:$roomVersion")
  115. // To use Kotlin annotation processing tool (kapt)
  116. kapt("androidx.room:room-compiler:$roomVersion")
  117. // AWS IOT CORE - MQTT
  118. // implementation 'com.amazonaws:aws-iot-device-sdk-java:1.3.9'
  119. // implementation project(path: ':libawsmqtt')
  120. // implementation project(path: ':libaws-mqtt-android')
  121. //Add this to get SystemProperties
  122. compileOnly(files("${SDK_DIR}/platforms/android-24/data/layoutlib.jar"))
  123. }