Kotlin plugin error: Could not generate a proxy class for class org.jetbrains.kotlin.gradle.tasks.KotlinCompile

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

The Kotlin compiler now requires JDK 8 to run. You shouldn’t notice any changes, because most other Java development tools such as Gradle and the Android toolchain also require JDK 8, so you almost certainly already have it installed. For code generated by the compiler, Java 1.6 compatibility is still the default, and we have no plans to drop support for generating Java 1.6 compatible bytecode.


In my case, it was because I was running gradle with java 1.7 and it looks like the plugin was compiled only for 1.8:

16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'kotlin']
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:153)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:113)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:80)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:136)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:46)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.java:34)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.Script$apply$1.callCurrent(Unknown Source)
16:48:42.742 [ERROR] [org.gradle.BuildExceptionReporter]        at build_4u37tyfuy0k7d4zd8vsk5lx9d.run(build.gradle:17)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        ... 63 more
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.GradleException: Could not generate a proxy class for class org.jetbrains.kotlin.gradle.tasks.KotlinCompile.
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:201)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.AbstractClassGenerator.generate(AbstractClassGenerator.java:64)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.taskfactory.TaskFactory.create(TaskFactory.java:115)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:77)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.createTask(AnnotationProcessingTaskFactory.java:101)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.createTask(DependencyAutoWireTaskFactory.java:39)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:62)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:97)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.tasks.KotlinTasksProvider.createKotlinJVMTask(TasksProvider.kt:26)
16:48:42.743 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.Kotlin2JvmSourceSetProcessor.doCreateTask(KotlinPlugin.kt:111)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.Kotlin2JvmSourceSetProcessor.doCreateTask(KotlinPlugin.kt:93)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetProcessor.createKotlinCompileTask(KotlinPlugin.kt:83)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetProcessor.<init>(KotlinPlugin.kt:56)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.Kotlin2JvmSourceSetProcessor.<init>(KotlinPlugin.kt:101)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.KotlinPlugin.buildSourceSetProcessor$kotlin_gradle_plugin_main(KotlinPlugin.kt:302)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.KotlinPlugin.buildSourceSetProcessor$kotlin_gradle_plugin_main(KotlinPlugin.kt:295)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.AbstractKotlinPlugin$configureSourceSetDefaults$1.execute(KotlinPlugin.kt:279)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.AbstractKotlinPlugin$configureSourceSetDefaults$1.execute(KotlinPlugin.kt:256)
16:48:42.744 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:110)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.AbstractKotlinPlugin.configureSourceSetDefaults(KotlinPlugin.kt:278)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.AbstractKotlinPlugin.apply(KotlinPlugin.kt:269)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.KotlinPlugin.apply(KotlinPlugin.kt:306)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.KotlinPlugin.apply(KotlinPlugin.kt:295)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper.apply(KotlinPluginWrapper.kt:46)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper.apply(KotlinPluginWrapper.kt:34)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:137)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        ... 73 more
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.UnsupportedClassVersionError: org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments : Unsupported major.minor version 52.0
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.reflect.ClassInspector.inspectClass(ClassInspector.java:67)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.reflect.ClassInspector.visitGraph(ClassInspector.java:51)
16:48:42.745 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.reflect.ClassInspector.inspect(ClassInspector.java:31)
16:48:42.746 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.AbstractClassGenerator.inspectType(AbstractClassGenerator.java:260)
16:48:42.746 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.AbstractClassGenerator.inspectType(AbstractClassGenerator.java:216)
16:48:42.746 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:95)

Related tickets: https://youtrack.jetbrains.com/issue/KT-17866 and https://youtrack.jetbrains.com/issue/KT-17297

Tags:

Gradle

Kotlin