I am new with Jetpack Compose and Hilt, I got problems when building the application after implementing the class module
Execution failed for task ':app:kaptDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
I use Catalog Version, this is the file:
[versions]
agp = "8.4.1"
kotlin = "1.9.0"
coreKtx = "1.13.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
lifecycleRuntimeKtx = "2.8.2"
activityCompose = "1.9.0"
composeBom = "2023.08.00"
composeMaterial = "1.6.0"
lifecyclevm = "2.7.0"
navcompose ="2.7.6"
kotlinCoroutines = "1.6.4"
hiltversion = "2.44"
hiltComposeNav = "1.0.0"
hiltWork = "1.0.0"
retrofitVer = "2.9.0"
okhttpVer = "4.9.2"
rerofitGsonCv = "2.4.0"
gsonVer = "2.8.5"
coilVer = "2.4.0"
materialIcon = "1.5.4"
flowlVer = "0.28.0"
flexibleBs = "0.1.3"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-compose-material = { module="androidx.compose.material:material", version.ref="composeMaterial"}
lifecycle-viewmodel = { module="androidx.lifecycle:lifecycle-viewmodel-compose", version.ref="lifecyclevm"}
navigation-compose = { module="androidx.navigation:navigation-compose", version.ref="navcompose"}
kotlin-coroutines = { module="org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref="kotlinCoroutines" }
hilt = { module="com.google.dagger:hilt-android", version.ref="hiltversion"}
hilt-compiler = { module="com.google.dagger:hilt-compiler", version.ref="hiltversion"}
hilt-android-compiler = {module="com.google.dagger:hilt-android-compiler", version.ref="hiltversion"}
hilt-navigation-compose = { module="androidx.hilt:hilt-navigation-compose", version.ref="hiltComposeNav"}
flowlayout = { module="com.google.accompanist:accompanist-flowlayout", version.ref="flowlVer"}
#Retrofit
retrofit = { module="com.squareup.retrofit2:retrofit", version.ref="retrofitVer"}
okhttp = { module="com.squareup.okhttp3:okhttp", version.ref="okhttpVer" }
okhttp-log = { module="com.squareup.okhttp3:logging-interceptor", version.ref="okhttpVer"}
retrofit-converter-gson = { module="com.squareup.retrofit2:converter-gson", version.ref="rerofitGsonCv"}
gson = { module="com.google.code.gson:gson", version.ref="gsonVer"}
coil = { module="io.coil-kt:coil-compose", version.ref="coilVer"}
material-icons = { module="androidx.compose.material:material-icons-extended-android", version.ref="materialIcon"}
flexible-bottomsheet = { module="com.github.skydoves:flexible-bottomsheet-material3", version.ref="flexibleBs"}
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version= "1.9.0"}
dagger-hilt = { id = "com.google.dagger.hilt.android", version="2.44"}
And this is my build.gradle
(module)
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.dagger.hilt)
alias(libs.plugins.kotlin.kapt)
}
android {
namespace 'com.beliaja.frapomate'
compileSdk 34
defaultConfig {
applicationId "com.beliaja.frapomate"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled 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 {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.1'
}
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation libs.androidx.core.ktx
implementation libs.androidx.lifecycle.runtime.ktx
implementation libs.androidx.activity.compose
implementation platform(libs.androidx.compose.bom)
implementation libs.androidx.ui
implementation libs.androidx.ui.graphics
implementation libs.androidx.ui.tooling.preview
implementation libs.androidx.material3
implementation libs.androidx.compose.material
implementation libs.material.icons
implementation libs.flowlayout
implementation libs.flexible.bottomsheet
implementation libs.lifecycle.viewmodel
implementation libs.navigation.compose
implementation libs.kotlin.coroutines
implementation libs.hilt
kapt libs.hilt.compiler
kapt libs.hilt.android.compiler
implementation libs.hilt.navigation.compose
implementation libs.retrofit
implementation libs.okhttp
implementation libs.okhttp.log
implementation libs.retrofit.converter.gson
implementation libs.gson
implementation libs.coil
testImplementation libs.junit
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.androidx.espresso.core
androidTestImplementation platform(libs.androidx.compose.bom)
androidTestImplementation libs.androidx.ui.test.junit4
debugImplementation libs.androidx.ui.tooling
debugImplementation libs.androidx.ui.test.manifest
}
// Allow reference to generate code
kapt {
correctErrorTypes = true
}
and this is my build.gradle
(project)
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false
alias(libs.plugins.dagger.hilt) apply false
alias(libs.plugins.kotlin.kapt) apply false
}
Every time i added this module the project build is failed,
@Module
@InstallIn(SingletonComponent::class)
object AppModule {
@Provides
@Singleton
fun provideRetrofit(): Retrofit {
return Retrofit.Builder()
.baseUrl("https://your-api-base-url.com/")
.addConverterFactory(GsonConverterFactory.create())
.build()
}
}
Please anyone can help me?