Caused by: org.jetbrains.kotlin.gradle.tasks.CompilationErrorException: Compilation error. See log for more details
앱을 실행했더니 처음 뜨는 오류는 이거였다.
jetbrains의존성을 설정안해서 나타나는 오류인줄 알아서 jetbrains의존성을 설정했더니 아래와 같은 오류가 또 발생했다.
Schema export directory was not provided to the annotation processor so Room cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument by applying the Room Gradle plugin (id 'androidx.room') OR set exportSchema to false.
이번에는 룸디비 스키마를 지정해줘야된다고 나와있어서 경로를 지정해줘야되는데, 일단 이걸 해결해결하면 오류가 해결되는지 보기위해서 임시로 exportSchema = false 로 설정해서 경로지정이 안되도록 설정해봤다.
그런데도 계속 jetbrains의존성 오류가 발생했다 (룸디비 스키마 오류지정도 아니였음)
계속 서치해본결과, 나의 ksp버전과 파이어베이스 버전이 서로 안맞아서 발생하는 오류였다.
최신 버전으로 몽땅 바꿔주고싶었지만... 그럼 변경해줘야할 라이브러리나 의존성들이 너무 많아서 시간이 너무 오래걸릴것같았기때문에 ... 최신버전으로 몽땅 업그레이드하는것은 앱배포후에 해보기로 결정
libs.versions.toml
우선 내 코틀린 버전은 1.9.0이였고, ksp 버전은 1.9.21-1.0.16이다.
처음에는 이 두버전도 일치하지 않는줄 알았지만, 파이어베이스 의존성만 추가하면 앱오류가 생기는걸 보니, 파이어베이스버전과 맞지 않음이 분명했었다.
kotlin = "1.9.0"
ksp = "1.9.21-1.0.16"
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
# Hilt
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } # Hilt
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
build.gradle.kts(project)
원래는 현시점 파이어베이스 최신버전이 4.4.2버전이였는데, 현재 설정한 코틀린버전과 일치하지 않아서 4.4.1로 버전을 낮춰주었다.
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
// hilt
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false
// firebase
id("com.google.gms.google-services") version "4.4.1" apply false
}
build.gradle.kts(app)
원래는 주석이 쳐져있는 파이어베이스 버전이 가장 최신버전이지만, 일치하지 않기때문에
밑에 있는 버전으로 다운그레이드함으로써 버전 불일치 에러를 해결했다.
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
id("kotlin-parcelize")
id("com.google.gms.google-services")
}
android {
namespace = "com.example.jikimi"
compileSdk = 36
defaultConfig {
applicationId = "com.example.jikimi"
minSdk = 24
targetSdk = 36
versionCode = 1
versionName = "1.0"
multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
packaging {
resources.excludes += "META-INF/DEPENDENCIES"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
buildConfig = true
viewBinding = true
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
...
// firebase
// implementation(platform("com.google.firebase:firebase-bom:33.12.0"))
// implementation("com.google.firebase:firebase-analytics")
// implementation("com.google.firebase:firebase-analytics-ktx")
// implementation ("com.google.firebase:firebase-auth-ktx:23.2.0")
// implementation ("com.google.firebase:firebase-firestore-ktx:25.1.3")
// implementation("com.google.firebase:firebase-storage")
implementation(platform("com.google.firebase:firebase-bom:33.0.0"))
implementation("com.google.firebase:firebase-analytics")
implementation("com.google.firebase:firebase-auth-ktx")
implementation("com.google.android.gms:play-services-auth:20.7.0")
implementation("com.google.firebase:firebase-firestore")
implementation("com.firebaseui:firebase-ui-storage:8.0.2")
}
이 오류땜에 하루를 통으로 다썼다.....ㅎㅎ
코드에러보다 버전 불일치 에러를 해결하는게 더 어려운것같다ㅠ
그래도 이번 오류로 kotlin버전, ksp버전, firebase버전이 맞아야 에러가 안난다는걸 알게되었다.
일단 임시로 버전을 낮춰놓은것이기때문에, 앱배포후에 다시 버전을 최신버전으로 바꿔봐야겠다
'개발 노트 > Kotlin' 카테고리의 다른 글
splashscreen 화면 구현하기 (0) | 2025.04.21 |
---|---|
[에러] 에뮬레이터 위치 설정이 안되는 에러 (0) | 2025.04.15 |
API key 연동시 인코딩 에러 (1) | 2024.10.16 |
[에러] hiltAggregateDepsDebug 에러 (0) | 2024.10.09 |
[API통신 에러]HTTP ROUTING ERROR (0) | 2024.10.06 |