Android-Gradle同步失败:org / jetbrains / kotlin / kapt / idea / KaptGradleModelorg / jetbrains / kotlin / kapt / idea / KaptGradleModel

ole*_*rio 5 android gradle kotlin android-studio

昨天,我的Android Studio没有任何理由开始显示以下消息:

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)
Run Code Online (Sandbox Code Playgroud)

但是我什至不使用Kotlin!这些是我的gradle文件:

//顶级构建文件,您可以在其中添加通用的配置选项

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'
Run Code Online (Sandbox Code Playgroud)

为什么会这样呢?我昨天也将我的Android Studio更新到了3.4版,但是这个错误在更新数小时后开始出现,因此我假设更新与该错误无关。

Sal*_*ali 15

升级您的Kotlin插件。

简单的方法(推荐)。

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

手动方式(如果需要)。

1)从此链接手动下载Kotlin插件。

2)双击->插件->(设置)图标->从磁盘安装->选择该插件。

3)重新启动。


小智 5

如果您无法更新它,则可以像这样禁用它:Double shift->插件->已安装->搜索Kotlin->右键单击-> Disable-> OK再次重新打开此对话框:Double shift-> Plugins->安装->搜索Kotlin->右键单击->启用->确定->重新启动IDE并完成。


ole*_*rio 0

几天后,错误从我的 IDE 中消失了。我相信上次更新中存在某种错误。