Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Gradle sync failed: org/jetbrains/kotlin/kapt/idea/KaptGradleModelorg/jetbrains/kotlin/kapt/idea/KaptGradleModel

Yesterday, without any reason, my Android Studio starts to show the following message:

Gradle sync failed: org/jetbrains/kotlin/kapt/idea/KaptGradleModelorg/jetbrains/kotlin/kapt/idea/KaptGradleModel
Consult IDE log for more details (Help | Show Log) (2 s 227 ms)

But I not even using Kotlin! Those are my gradle files:

// Top-level build file where you can add configuration options common to

all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        // Firebase import
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        // Stupid kotlin build-in plugin
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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


apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    compileSdkVersion 28
    testOptions  {
        unitTests {
            includeAndroidResources = true
            returnDefaultValues = true
        }
    }
    defaultConfig {
        applicationId "com.example.olegario.escamboapp"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    // Scroll view
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    // Firebase
    implementation 'com.google.firebase:firebase-core:16.0.5'
    // Firebase database
    implementation 'com.google.firebase:firebase-database:16.0.6'
    // Firebase storage
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    // Firebase authentication
    implementation 'com.google.firebase:firebase-auth:16.0.5'

    // Mask
    implementation 'com.vicmikhailau:MaskedEditText:2.0.4'

    // test
    testImplementation 'junit:junit:4.12'
    testImplementation 'androidx.test:core:1.0.0'
    testImplementation 'org.mockito:mockito-core:1.10.19'
    testImplementation 'org.robolectric:robolectric:4.2'
    androidTestImplementation 'org.mockito:mockito-android:+'
    androidTestImplementation 'com.android.support:support-annotations:24.0.0'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    androidTestImplementation 'com.android.support.test:rules:0.5'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'

    // Framework
    implementation project(':capuccino')

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

Why this is happening? I updated my Android Studio yesterday too, to the version 3.4, but this error started to appear after hours of the update, so I'm assuming that the update has nothing to do with the error.

like image 977
olegario Avatar asked Apr 20 '19 15:04

olegario


3 Answers

Upgrade your Kotlin plugin.

The simple way (Recommended).

Double shift -> Plugins -> Updates -> search Kotlin -> Update! -> Restart AS

Manually way (If you need).

1) Download Kotlin Plugin manually from this link.

2) Double shift -> Plugins -> (Settings) Icon -> Install from disk -> Choose that plugin.

3) Restart.

like image 94
Salam Hiyali Avatar answered Oct 18 '22 01:10

Salam Hiyali


If you can't update it, you can just disable it like this: Double shift -> Plugins -> installed -> search Kotlin -> right click -> Disable -> OK reopen this dialog again: Double shift -> Plugins -> installed -> search Kotlin -> right click -> Enable -> OK -> Restart IDE And it'd done.

like image 33
Simpson Yang Avatar answered Oct 18 '22 00:10

Simpson Yang


Thanks "Salam Hiyali" your answer saved me from reinstalling the Android Studio all over again...

A little modification in the answer given by

Salam Hiyali

Double shift -> Plugins -> Install JetBrains plugin... --> search Kotlin -> Update! -> Restart AS

like image 44
Avi Avatar answered Oct 18 '22 00:10

Avi