【发布时间】:2017-10-17 23:20:53
【问题描述】:
尝试使用 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
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 {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我自己没有触及任何这些值,它们被保留为默认值。创建非Kotlin新项目没有这个问题。
【问题讨论】:
标签: android-studio kotlin