How to use Data Binding and Kotlin in Android Studio 3.0.0

后端 未结 4 1883
庸人自扰
庸人自扰 2020-11-29 22:40

I just started to use Android Studio 3.0.0, but every time I try to build my project I get this error:

Error:Circular dependency between the following tasks:         


        
4条回答
  •  心在旅途
    2020-11-29 23:17

    UPD: This was fixed for Android Gradle plugin 3.0.0-alpha3, in yout project root build.gradle, change the buildscript dependencies to use

    classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
    

    This is actually a bug in the Kotlin Gradle plugin 1.1.2-4 inter-operation with the Android Gradle plugin 3.0.0-alpha1, caused by how the inputs and outputs of the tasks are set (and thus how the tasks are connected with the depends-on relation).

    Thanks @VyacheslavGerasimov for creating the issue KT-17936.


    As a temporary workaround, you can try to revert to Kotlin Gradle plugin 1.1.2-2 and disable incremental compilation:

    In your project's root build.gradle, change the version of the Kotlin Gradle plugin:

    buildscript {
        ...
        dependencies {
            ...
            classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-2'
        }
    }
    

    Add local.properties to the project root, with the following line:

    kotlin.incremental=false
    

    It is a known issue that the Kotlin Gradle plugin 1.1.2-2 and below crashes with the newest AGP versions, and disabling incremental compilation seems to fix that crash.

提交回复
热议问题