Hy
I created an app which uses dagger, room, Moshi, Retrofit etc...
It works correctly until I add this line to my Model class : @JsonClass(generateAdapter = true)
After that I get this error:
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
java.lang.reflect.InvocationTargetException (no error message)
I don't know what is the problem, beacuse my another app is uses Moshi, and it works good.
I added all of the Moshi dependencies, and plugins
My gradle settings:
buildTypes {
        all {
            buildConfigField 'String', 'API_URL', "\"$apiurl\""
            lintOptions {
                abortOnError true
                //ignoreWarnings true
                fatal 'MissingTranslation', 'ExtraTranslation'
            }
        }
        debug {
            //applicationIdSuffix ".debug"
            ext.enableCrashlytics = false
            ext.alwaysUpdateBuildId = false
            multiDexEnabled true
        }
        staged {
            signingConfig signingConfigs.debug
            //applicationIdSuffix ".staged"
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', getDefaultProguardFile('proguard-android-optimize.txt')
            matchingFallbacks = ['debug']
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', getDefaultProguardFile('proguard-android-optimize.txt')
        }
    }
ApiModule:
  @Provides
    @Singleton
    fun provideMoshi(): Moshi {
        return Moshi.Builder()
            .add(DateConverter())
            .add(BigDecimalConverer())
            .add(KotlinJsonAdapterFactory())
            .build()
    }
@Provides
@Singleton
fun provideAuthApi(@Named("base_url") url: String, moshi: Moshi): AuthApi {
    var builder = OkHttpClient.Builder()
    builder = BuildTypeInitializations.setupInterceptor(builder)
    return Retrofit.Builder()
        .baseUrl(url)
        .addCallAdapterFactory(CoroutineCallAdapterFactory())
        .addConverterFactory(MoshiConverterFactory.create(moshi))
        .client(builder.build())
        .build()
        .create(AuthApi::class.java)
}
 
                        
For me only migrating from kapt to ksp helped
Here how to upgrade https://developer.android.com/build/migrate-to-ksp#kts
Change version to the last release version of ksp https://github.com/google/ksp/releases
And you may also need to update your kotlin plugin version, here you can find the latest https://kotlinlang.org/docs/releases.html#release-details