e: This version (1.2.0) of the Compose Compiler requires Kotlin version 1.7.0
but you appear to be using Kotlin version 1.8.0 which is not known to be compatible.
Please fix your configuration
(or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
▶ 기존 안드로이드 프로젝트의 ViewModel() 클래스 안에 LiveData 추가 후
class MainViewModel: ViewModel(){
private val _name = MutableLiveData<String>("")
val name: LiveData<String> = _name
fun onNameChange(newName:String){
_name.value=newName
}
}
▶build.gradle.kts 파일에 아래의 implementation 추가시 에러 메시지 입니다.
dependencies {
...
implementation("androidx.compose.runtime:runtime-livedata:1.4.0")
}
<해결책>
▶ 아래 안드로이드 코틀린 호환성 사이트 방문
https://developer.android.com/jetpack/androidx/releases/compose-kotlin
Compose와 Kotlin의 호환성 지도 | Android 개발자 | Android Developers
Compose와 Kotlin의 호환성 지도 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 종속 항목 선언 Compose 컴파일러에 관한 종속 항목을 추가하려면 프로젝트에 Googl
developer.android.com
▶ 사이트에서 보면 Compose Compiler Version 1.2.0 ,Compatible kotlin Version dl 1.7.0 이라고 나옴.
→ 아래처럼 1.2.0 으로 변경후 빌드 진행합니다.
dependencies {
...
implementation("androidx.compose.runtime:runtime-livedata:1.2.0")
}
▶ 에러가 사라지고 빌드가 성공하네요.
그럼 수고하세요.
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/003.gif)
반응형
'Android_app' 카테고리의 다른 글
[Android App] BLE GATT:: [2] 서비스 리스트 출력하기 (0) | 2023.04.25 |
---|---|
[Android App] BLE GATT:: [1] 연결시 코드 분석하기 (거꾸로 생각하기) (0) | 2023.04.25 |
[Android App] Composable Scaffold 에서 SnackBar 사용하기 (0) | 2023.04.10 |
[Android app] startActivityForResult () 사용 및 대체하기 (0) | 2023.04.04 |
[Android App] BroadcastReceiver 간단히 사용해 보기 (0) | 2023.04.04 |