TIL #106

loci·2024년 8월 27일
0

TIL

목록 보기
97/103

Hilt

종속성 설정

// (project: )
plugins {  
   alias(libs.plugins.hilt) apply false  
	id("org.jetbrains.kotlin.jvm") version "2.0.0"
}
buildscript {  
    repositories {  
        google()  
        mavenCentral()  
    }  
    dependencies {  
        classpath(libs.hilt.android.gradle.plugin)  
    }  
}

//(Module: app)
plugins {  
	alias(libs.plugins.ksp) apply false
    alias(libs.plugins.ksp)  
	id("com.google.dagger.hilt.android")
}
//hilt
implementation(libs.dagger.hilt.android)  
ksp(libs.hilt.compiler)


hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt"
}

hilt = "2.48"
ksp = "2.0.0-1.0.23"

// gradle.poperties
kapt.use.worker.api=false

오류

kapt에서 ksp로 바꾼 후 build시 오류

Execution failed for task ':app:kspDebugKotlin'. > 'org.jetbrains.kotlin.incremental.ChangedFiles com.google.devtools.ksp.gradle.KspTaskJvm.getChangedFiles(org.gradle.work.InputChanges, java.util.List)' * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 1m 1s 56 actionable tasks: 56 executed Unable to find method ''org.jetbrains.kotlin.incremental.ChangedFiles com.google.devtools.ksp.gradle.KspTaskJvm.getChangedFiles(org.gradle.work.InputChanges, java.util.List)'' 'org.jetbrains.kotlin.incremental.ChangedFiles com.google.devtools.ksp.gradle.KspTaskJvm.getChangedFiles(org.gradle.work.InputChanges, java.util.List)' Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network) The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart) Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project. In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

해결방법

ksp 버전 바꾸고

ksp = "2.0.0-1.0.23"

build.gradle(project)에 plugins에 추가

id("org.jetbrains.kotlin.jvm") version "2.0.0"
profile
편리한 개발자

0개의 댓글