본문으로 바로가기

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")
}

 

  에러가 사라지고 빌드가 성공하네요.

 

그럼 수고하세요.

 

반응형