Moshi: Execution failed for task ':app:kaptDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction > java.lang.reflect.InvocationTargetException (no error message)

Created on 1 Apr 2021  路  3Comments  路  Source: square/moshi

I was just started learning Retrofit2 with Moshi but having difficulty during compilation/building.

This is the error from Build Output

```
Execution failed for task ':app:kaptDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
java.lang.reflect.InvocationTargetException (no error message)


This is what my app level gradle file looks like

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.google.firebase.crashlytics'
}

android {
compileSdkVersion 30

defaultConfig {
    applicationId "com.app.app"
    minSdkVersion 21
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
    vectorDrawables.useSupportLibrary = true
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    debug {
        debuggable true
        minifyEnabled true
        shrinkResources true
        multiDexEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
    release {
        debuggable false
        minifyEnabled true
        shrinkResources true
        multiDexEnabled true
        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 {
    viewBinding true
}

}

dependencies {

implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.4'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.0-M2'

//Required: Google Play Services Ads Identifier (If publishing to Google Play)
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'

//Required: Install Referrer (If publishing to Google Play)
implementation 'com.android.installreferrer:installreferrer:2.2'

implementation 'com.google.firebase:firebase-config:20.0.4'
implementation 'com.google.firebase:firebase-firestore:22.1.2'
implementation 'com.google.firebase:firebase-analytics:18.0.2'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation 'com.google.firebase:firebase-crashlytics:17.4.1'
implementation 'com.google.firebase:firebase-inappmessaging:19.1.5'
implementation 'com.google.firebase:firebase-inappmessaging-display:19.1.5'

// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:7.1.1'

implementation 'com.google.firebase:firebase-auth:20.0.3'

implementation 'com.google.android:flexbox:1.0.0'
implementation 'com.github.mahimrocky:TagView:1.0.3'

kapt('com.squareup.moshi:moshi-kotlin-codegen:1.11.0')
implementation 'com.squareup.moshi:moshi-kotlin:1.11.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'

implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'

}
apply plugin: 'com.google.gms.google-services'


This is project level gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://jitpack.io" }
maven { url "https://google.bintray.com/flexbox-layout" }
maven { url = "https://dl.bintray.com/kotlin/kotlin-eap" }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0-alpha10"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-M2'

    classpath 'com.google.gms:google-services:4.3.5'

    // Add the Crashlytics Gradle plugin.
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://jitpack.io" }
maven { url "https://google.bintray.com/flexbox-layout" }
maven { url = "https://dl.bintray.com/kotlin/kotlin-eap" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

```

bug

Most helpful comment

Fix is merged to master already. Just waiting on a release.

All 3 comments

Dupe of #1324

Fix is merged to master already. Just waiting on a release.

Fix is merged to master already. Just waiting on a release.

Thanks for immediate answer, will just downgrade to M1 for now

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piorrro33 picture piorrro33  路  3Comments

rephiscorth picture rephiscorth  路  5Comments

ayedo picture ayedo  路  4Comments

bfarrelladelphi picture bfarrelladelphi  路  4Comments

kapil93 picture kapil93  路  4Comments