build.gradle(groovy)
android {
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.3.2"
}
}
def composeBom = platform('androidx.compose:compose-bom:2022.10.00')
implementation composeBom
androidTestImplementation composeBom
// Material 디자인 라이브러리는 2 또는 3 중에 선택
// Material Design 3 (실험적이라 일부 사용에 OptIn이 필요함)
implementation 'androidx.compose.material3:material3'
// 또는 Material Design 2
implementation 'androidx.compose.material:material'
// 또는 Material 디자인을 skip하고, 기본 구성요소 위에 직접 빌드
implementation 'androidx.compose.foundation:foundation'
// 또는 입력 및 측정/레이아웃과 같은 기본 toolkit 시스템의 기본 API만 import
implementation 'androidx.compose.ui:ui'
// 안드로이드 스튜디오의 컴포저블 미리보기
implementation 'androidx.compose.ui:ui-tooling-preview'
debugImplementation 'androidx.compose.ui:ui-tooling'
// UI 테스팅
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
// Optional - Included automatically by material, only add when you need
// the icons but not the material library (e.g. when using Material3 or a
// custom design system based on Foundation)
implementation 'androidx.compose.material:material-icons-core'
// Optional - Add full set of material icons
implementation 'androidx.compose.material:material-icons-extended'
// Optional - Add window size utils
implementation 'androidx.compose.material3:material3-window-size-class'
// Optional - Integration with activities
implementation 'androidx.activity:activity-compose:1.5.1'
// Optional - Integration with ViewModels
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1'
// Optional - Integration with LiveData
implementation 'androidx.compose.runtime:runtime-livedata'
// Optional - Integration with RxJava
implementation 'androidx.compose.runtime:runtime-rxjava2'
출처 참고: https://jinhyun.blog/android/jetpack-compose/jetpack-compose-start/
제트팩 컴포즈 시작하기 - 주진현의 스냅샷
jinhyun.blog
위처럼 세팅을 해주었을 때
e: This version (1.3.2) of the Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.7.21 which is not known to be compatible. Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
위와 같은 에러가 발생할 수 있다.
이 경우에는 컴포즈 컴파일 버전과 코틀린 버전이 호환되지 않아 발생하는 에러로 버전을 호환시켜주도록 한다.
출처 참고:
This version Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.8.0 which is not known
if you get this error in android studio "This version (1.3.2) of the Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.8.0 which is not known to be
stackoverflow.com
https://developer.android.com/jetpack/androidx/releases/compose-kotlin?hl=ko
Compose와 Kotlin의 호환성 지도 | Android 개발자 | Android Developers
이 페이지는 Cloud Translation API를 통해 번역되었습니다. Compose와 Kotlin의 호환성 지도 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 종속 항목 선언 Compose 컴
developer.android.com