build.gradle 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. }
  34. compileOptions {
  35. sourceCompatibility JavaVersion.VERSION_1_8
  36. targetCompatibility JavaVersion.VERSION_1_8
  37. }
  38. buildFeatures {
  39. compose true
  40. viewBinding true
  41. }
  42. composeOptions {
  43. kotlinCompilerExtensionVersion "$compose_version"
  44. }
  45. }
  46. dependencies {
  47. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  48. implementation 'androidx.core:core-ktx:1.7.0'
  49. implementation 'androidx.appcompat:appcompat:1.3.1'
  50. implementation 'com.google.android.material:material:1.4.0'
  51. implementation "androidx.fragment:fragment-ktx:1.3.6"
  52. implementation "androidx.activity:activity-compose:$activity_compose_version"
  53. implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
  54. implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0"
  55. implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
  56. implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$viewmodel_compose_version"
  57. implementation "androidx.compose.animation:animation:$compose_version"
  58. implementation "androidx.compose.foundation:foundation:$compose_version"
  59. implementation "androidx.compose.foundation:foundation-layout:$compose_version"
  60. implementation "androidx.compose.material:material:$compose_version"
  61. implementation "androidx.compose.material:material-icons-extended:$compose_version"
  62. implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
  63. implementation "androidx.compose.runtime:runtime:$compose_version"
  64. implementation "androidx.compose.ui:ui:$compose_version"
  65. implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
  66. debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
  67. testImplementation 'junit:junit:4.13.2'
  68. testImplementation "com.google.truth:truth:1.1.2"
  69. androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  70. androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  71. }
  72. // Compiler flag to use experimental Compose APIs
  73. tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
  74. kotlinOptions {
  75. jvmTarget = "1.8"
  76. freeCompilerArgs += [
  77. "-Xopt-in=kotlin.RequiresOptIn"
  78. ]
  79. }
  80. }