Jos*_*ird 98 kotlin android-studio
尝试使用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 {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
我自己没有触及任何这些值,它们被保留为默认值.创建非Kotlin新项目没有这个问题.
Jos*_*ird 197
在我的build.gradle中更改
ext.kotlin_version = '1.1.2-3'
至
ext.kotlin_version = '1.1.2-4'
修好了.
您可以在此处找到最新版本.
| 归档时间: |
|
| 查看次数: |
13807 次 |
| 最近记录: |