Flutter + android emulator로 앱을 디버깅하다보면 종종 다음과 같은 에러가 뜨면서 실행이 안되는 경우가 있슴돠. (저는 Geolocator를 import해서 사용하기만 하면 에뮬레이터가 해당 에러가 떴슴니다)
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
* What went wrong: Execution failed for task ':app:compileDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details
에러와 함께 Flutter Fix가 제공해주는 해결책을 보면, Your project requires a newer version of the Kotlin Gradle plugin.이라고 나옵니다.
뭔가 Kotlin Gradle plugin의 버전을 업데이트하면 해결해 줄 것 같아서 구글링을 해보면 프로젝트>android>build.gradle 파일에서 buildsciprt부분에서 kotlin 버전을 수정해주라고 나옵니다.
하지만 웬걸? build.gradle 파일에는 buildscript나 kotlin 버전과 관련된 내용이 없습니다. 구글링을 좀 더 해보니, 프로젝트>android>settings.gradle 파일에 관련 내용이 있을 가능성이 있어 확인을 해봅니다.
관련 내용이 있습니다. 저기서 kotlin.android의 version을 경고창에서 나온 것처럼 1.7.1이 아니라 1.9.0으로 바꿔봅니다. 이 부분을 수정해주는 것이 만병통치약은 아닐 지 모르지만, 저는 놀랍게도 해결이 되어 공유해봅니다
'Flutter' 카테고리의 다른 글
[Flutter] AlertDialog 에서 TableCalendar 쓰기 (0) | 2024.11.13 |
---|---|
[Flutter] Geolocator 플러그인으로 위치 정보 파악하기 (0) | 2024.11.13 |
[Flutter] Stream Builder에서 TypeError (Null check operator used on a null value) 가 뜨는 경우 해결법 (2) | 2024.11.10 |
[Flutter] Firebase 파이어베이스 연동하기 - flutterfire 에러들 (0) | 2024.11.10 |
Flutter vs React Native? (5) | 2024.11.10 |