I have been trying to implement a mobile application which was supposed to use Dagger Hilt, Glide and Kapt. However, when I tried to implement it, i got this error
error message:
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
java.lang.reflect.InvocationTargetException (no error message)
i tried to change hilt version to latest version but still i face the same issues
build.gradle (project)
buildscript {
ext.kotlin_version = '1.9.0'
repositories {
maven { url "https://repo1.maven.org/maven2" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id 'com.android.application' version '8.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
id 'com.android.library' version '8.1.2' apply false
id 'com.google.dagger.hilt.android' version '2.51.1' apply false
id 'com.google.gms.google-services' version '4.3.15' apply false
// id 'com.google.firebase.crashlytics' version '2.9.8' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
setting.gradle
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
flatDir {
dirs 'libs' // aar
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs' // aar
}
maven { url 'https://jitpack.io' }
maven { url "https://repo1.maven.org/maven2" }
}
}
build.gradle (app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-parcelize'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.google.dagger.hilt.android'
id 'com.google.gms.google-services'
// id 'com.google.firebase.crashlytics'
}
android {
namespace 'com.print.app'
compileSdk 34
defaultConfig {
applicationId "com.print.app"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
def setOutputFileName = { prefix ->
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${prefix}-${variant.buildType.name.capitalize()}-${variant.mergedFlavor.versionName}.apk"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "BASE_URL", LIVE_URL
signingConfig signingConfigs.release
}
debug {
buildConfigField "String", "BASE_URL", DEVELOPMENT_URL
signingConfig signingConfigs.debug
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
buildFeatures {
viewBinding true
dataBinding true
buildConfig true
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
aidl.srcDirs = ['src/main/aidl']
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.activity:activity-ktx:1.7.2'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'com.google.code.gson:gson:2.10.1'
implementation project(path: ':network')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
// Hilt
implementation "com.google.dagger:hilt-android:2.51.1"
kapt "com.google.dagger:hilt-compiler:2.51.1"
//Preferences DataStore
implementation("androidx.datastore:datastore-preferences:1.1.0")
// Lifecycle
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
//ssp and sdp lib
implementation 'com.intuit.ssp:ssp-android:1.1.0'
implementation 'com.intuit.sdp:sdp-android:1.1.0'
//coroutines lib
def coroutines = "1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines"
// //glide lib
// def glide = "4.16.0"
// implementation "com.github.bumptech.glide:glide:$glide"
// kapt "com.github.bumptech.glide:compiler:$glide"
// Using Exoplayer lib so we can manage cache easily.
implementation "com.google.android.exoplayer:exoplayer:2.18.7"
// //Firebase dependencies
// implementation platform('com.google.firebase:firebase-bom:32.2.0')
// implementation 'com.google.firebase:firebase-analytics-ktx'
// implementation "com.google.firebase:firebase-crashlytics-ktx"
// implementation("com.google.firebase:firebase-firestore")
implementation 'androidx.fragment:fragment-ktx:1.6.2'
// kapt 'org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.2'
kapt "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.2"
}
kapt {
correctErrorTypes true
}
2