try 运行gradle任务时出错.无法确定还需要什么或错误是关于什么的.我正在做的项目有几个子项目,所以我有一个主构建.格雷德尔.错误是针对我想try Kotlin的子项目.

* Where: Build file '/home/oracle/bnc/KotlinHandler/build.gradle' line: 13

* What went wrong: A problem occurred evaluating root project 'KotlinHandler'.
> Failed to apply plugin [id 'kotlin']
   > Could not generate a proxy class for class org.jetbrains.kotlin.gradle.tasks.KotlinCompile.

Here is my build.gradle for the failing module (sub-project).

buildscript {
    ext.kotlin_version = '1.1.2-2'

    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

apply plugin: 'kotlin'

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

Here is Pastebin build.gradle which is quite big, because of all the tasks in it

Added --debug output after changing jdk to 1.8 and compile dependency to compile "org.jetbrains.kotlin:kotlin-stdlib-jre8

推荐答案

starting kotlin 1.1.2 JDK below 1.8 is not supported anymore by the kotlin compiler as in 1.1.2 blog post:

Kotlin编译器现在需要运行JDK 8.您应该不会注意到任何变化,因为大多数其他Java开发工具(如Gradle和Android工具链)也需要JDK 8,因此您几乎可以肯定已经安装了它.对于编译器生成的代码,Java1.6兼容性仍然是默认设置,我们不打算放弃对生成Java1.6兼容字节码的支持.

Kotlin相关问答推荐

为什么在Spring中,对事务性方法调用的非事务方法调用仍然在事务中运行?

Spring Boot Kotlin 数据类未使用 REST 控制器中的默认值初始化

根据字符串值动态过滤数组列表 - kotlin

如何规避 Kotlin 的泛型类型差异约束

Jetpack Compose:当状态从另一个活动改变时强制重组

为什么 Kotlin 在 sumOf 函数 lambda 中默认不将数字视为Int?

Kotlin:如何使用第一个参数的默认值进行函数调用并为第二个参数传递一个值?

retrofit 响应代码 405 并带有消息method not allowed here

调用单元测试验证伴随对象方法

如何用 kotlin 打包 List

如何从 Firestore 查询中排除元素?

Kotlin中的测试无法访问受保护(protected)的方法

Kotlin not nullable值可以为null吗?

无法解决:androidx.lifecycle:lifecycle-extensions-ktx:2.0.0-alpha1

在Kotlin中将列表转换为对的惯用方法

在android java类中使用Kotlin扩展

如何在 firebase 数据库中使用 kotlin 协程

Kotlin:获取文件的扩展名,例如.txt

Kotlin for assertThat(foo, instanceOf(Bar.class))

Dagger 2 androidx fragment不兼容类型