尝试使用Android Studio 3.0 Canary 1启动新的Kotlin项目会显示此错误.完整跟踪:
错误:无法找到方法'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'.此意外错误的可能原因包括:
在损坏的Gradle进程的情况下,您还可以尝试关闭IDE,然后终止所有Java进程.
- Gradle的依赖缓存可能已损坏(这有时会在网络连接超时后发生.)重新下载依赖项并同步项目(需要网络)
- Gradle构建过程(守护程序)的状态可能已损坏.停止所有Gradle守护进程可以解决此问题.停止Gradle构建过程(需要重启)
- 您的项目可能正在使用第三方插件,该插件与项目中的其他插件或项目请求的Gradle版本不兼容.
我尝试了前两个选项,第三方插件保留为默认值.
gradle-wrapper.properties
#Thu May 18 08:36:52 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
Run Code Online (Sandbox Code Playgroud)
的build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
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 { …Run Code Online (Sandbox Code Playgroud) 我刚开始使用Android Studio 3.0.0,但每次尝试构建我的项目时都会收到此错误:
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)
我在用
kapt "com.android.databinding:compiler:2.2.0"
Run Code Online (Sandbox Code Playgroud)
在我使用之前
androidProcessor "com.android.databinding:compiler:2.2.0"
Run Code Online (Sandbox Code Playgroud)
它工作得很好......我做错了什么?
谢谢!
android kotlin android-studio android-databinding android-studio-3.0