build.gradle 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (C) 2020 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. plugins {
  17. id 'com.android.application'
  18. id 'kotlin-android'
  19. }
  20. android {
  21. compileSdkVersion 31
  22. defaultConfig {
  23. applicationId "com.example.statecodelab"
  24. minSdkVersion 21
  25. targetSdkVersion 31
  26. versionCode 1
  27. versionName "1.0"
  28. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  29. }
  30. kotlinOptions {
  31. jvmTarget = '1.8'
  32. useIR = true
  33. allWarningsAsErrors = true
  34. }
  35. compileOptions {
  36. sourceCompatibility JavaVersion.VERSION_1_8
  37. targetCompatibility JavaVersion.VERSION_1_8
  38. }
  39. buildFeatures {
  40. compose true
  41. }
  42. composeOptions {
  43. kotlinCompilerExtensionVersion "$compose_version"
  44. }
  45. }
  46. dependencies {
  47. implementation 'androidx.core:core-ktx:1.7.0'
  48. implementation 'androidx.appcompat:appcompat:1.3.1'
  49. implementation 'com.google.android.material:material:1.4.0'
  50. implementation "androidx.fragment:fragment-ktx:1.3.6"
  51. implementation "androidx.activity:activity-compose:$activity_compose_version"
  52. implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
  53. implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0"
  54. implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
  55. implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$viewmodel_compose_version"
  56. implementation "androidx.compose.animation:animation:$compose_version"
  57. implementation "androidx.compose.foundation:foundation:$compose_version"
  58. implementation "androidx.compose.foundation:foundation-layout:$compose_version"
  59. implementation "androidx.compose.material:material:$compose_version"
  60. implementation "androidx.compose.material:material-icons-extended:$compose_version"
  61. implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
  62. implementation "androidx.compose.runtime:runtime:$compose_version"
  63. implementation "androidx.compose.ui:ui:$compose_version"
  64. implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
  65. debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
  66. testImplementation 'junit:junit:4.13.2'
  67. testImplementation "com.google.truth:truth:1.1.2"
  68. androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  69. androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  70. }
  71. // Compiler flag to use experimental Compose APIs
  72. tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
  73. kotlinOptions {
  74. jvmTarget = "1.8"
  75. freeCompilerArgs += [
  76. "-Xopt-in=kotlin.RequiresOptIn"
  77. ]
  78. }
  79. }