相关疑难解决方法(0)

studio 3.0数据绑定与kotlin循环依赖性错误

当我classpath 'com.android.tools.build:gradle:3.0.0-alpha1' 像这样使用gradle时遇到错误 :

 Error:Circular dependency between the following tasks:
:app:compileDebugKotlin
+--- :app:dataBindingExportBuildInfoDebug
|    \--- :app:compileDebugKotlin (*)
\--- :app:kaptDebugKotlin
     \--- :app:dataBindingExportBuildInfoDebug (*)
(*) - details omitted (listed previously)
Run Code Online (Sandbox Code Playgroud)

这是我的项目build.gradle:

buildscript {
    ext.kotlin_version = '1.1.2-4'
    ext.support_version = "25.3.1"
    ext.butterknife_version = "8.4.0"
    ext.anko_version = "0.9"
    ext.bugly_upgrade= "1.2.4"

repositories {
    mavenCentral()
    jcenter()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
    allprojects {
        repositories {
            jcenter()
            mavenCentral()
            maven { url "https://jitpack.io" }
            maven {
                url 'https://oss.sonatype.org/content/repositories/snapshots/'
            } …
Run Code Online (Sandbox Code Playgroud)

android kotlin

8
推荐指数
0
解决办法
649
查看次数

任务之间的Gradle依赖性

因此,自从添加新的Room android架构库以来,这已经开始发生.我遇到了AppDatabase_Impl不存在的问题,我通过将kapt添加到注释中来修复:

我有其他错误,我怀疑是由于AS,Kotlin和Java 8,所以我尝试更新到AS 3.0

我在尝试构建时遇到以下错误:

Information:Gradle tasks [:app:generateDebugSources,     :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources, :cryptocurrency-icons:generateDebugSources, :cryptocurrency-icons:mockableAndroidJar, :cryptocurrency-icons:generateDebugAndroidTestSources, :cryptocurrency-icons:compileDebugSources, :cryptocurrency-icons:compileDebugUnitTestSources, :cryptocurrency-icons:compileDebugAndroidTestSources]
Error:Circular dependency between the following tasks:
:app:compileDebugKotlin
+--- :app:dataBindingExportBuildInfoDebug
|    \--- :app:compileDebugKotlin (*)
\--- :app:kaptDebugKotlin
     \--- :app:dataBindingExportBuildInfoDebug (*)
(*) - details omitted (listed previously)
Information:BUILD FAILED in 1s
Information:1 error
Information:0 warnings
Information:See complete output in console
Run Code Online (Sandbox Code Playgroud)

我的gradle文件看起来像:

项目gradle

// Top-level build file where you can add configuration options common to …
Run Code Online (Sandbox Code Playgroud)

android gradle kotlin android-databinding android-room

8
推荐指数
1
解决办法
1738
查看次数

Gradle 3.0.0-alpha1与kotlin-android插件1.1.2-3不兼容?

我安装Android Studio 3.0 Canary 1并使用kotlin创建新项目.并得到此错误:

错误:无法找到方法'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'.此意外错误的可能原因包括:

  • Gradle的依赖缓存可能已损坏(这有时会在网络连接超时后发生.)重新下载依赖项并同步项目(需要网络)
  • Gradle构建过程(守护程序)的状态可能已损坏.停止所有Gradle守护进程可以解决此问题.停止Gradle构建过程(需要重启)
  • 您的项目可能正在使用第三方插件,该插件与项目中的其他插件或项目请求的Gradle版本不兼容.
在损坏的Gradle进程的情况下,您还可以尝试关闭IDE,然后终止所有Java进程.

如果我从build.gradle中删除kotlin-android插件,它就成功构建了.

建立gradle:

buildscript {
    ext.kotlin_version = '1.1.2-3'
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

应用程序\的build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android …
Run Code Online (Sandbox Code Playgroud)

android gradle kotlin

4
推荐指数
1
解决办法
2077
查看次数