简体   繁体   中英

Error upgrading to Kotlin 1.2.60, Android Studio 3.1.3

Pretext: I have 3 build variants for my project apart from release and debug I also have the staging variant.

Gradle sync works completely fine with version 1.2.51, but as soon as I upgrade to version 1.2.60, which released recently, gradle sync fails with the following error message:

Could not find method kapt() for arguments [build_9jdgbsb8xiz9dkrq42qtcg5eg$_run_closure1$_closure6@576656b5] on object of type com.android.build.gradle.LibraryExtension.

Any help/ insight on this would be really great, I tried searching for a while, but was stuck on what to search exactly, what I think could be the issue here is the kapt plugin as the changelog mentions changes in it, chec this , but couldn't get it running.

Dependecies:

Top level gradle:

dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.realm:realm-gradle-plugin:$realm_version"
        classpath 'com.akaita.android:easylauncher:1.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.0.1'
        classpath 'io.fabric.tools:gradle:1.25.4'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
    }

App level:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'

apply plugin: 'realm-android'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

PS: I'm on Gradle plugin 4.9, Studio 3.1.3 and android gradle plugin 3.3.0-alpha03.

Thank you.

I found the solution to this, in case anyone struggles with it,

The problem:

I had a module dependency, which was using some kapt methods but hadn't included

apply plugin: 'kotlin-kapt' in it's project level build.gradle file.

I added it and voila, it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM