5

After bumping up kotlin-gradle-plugin from 1.1.4-3 to 1.1.50 (or 51), as well as all Kotlin related libraries I got error like below when trying to import gradle files:

Unable to build Kotlin project configuration Details: java.lang.reflect.InvocationTargetException: null Caused by: java.lang.NoSuchMethodError: kotlin.reflect.jvm.internal.KClassImpl.getData()Lkotlin/reflect/jvm/internal/ReflectProperties$LazyVal; 

Compilation works fine when using older version of plugin (1.1.4-3).

Full gradle file:

apply plugin: 'war' apply plugin: 'com.google.cloud.tools.appengine' apply plugin: 'kotlin' apply plugin: 'kotlin-kapt' apply plugin: "net.ltgt.apt" apply plugin: 'idea' apply plugin: 'org.jetbrains.dokka' def daggerVersion = "2.11" sourceCompatibility = '1.8' targetCompatibility = '1.8' buildscript { repositories { mavenCentral() maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.9" classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.2' classpath "net.ltgt.gradle:gradle-apt-plugin:0.3" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } dependencies { compile "com.google.appengine:appengine-api-1.0-sdk:${appengineVersion}" compile "com.google.appengine:appengine-endpoints-deps:${appengineVersion}" compile "com.google.dagger:dagger:${daggerVersion}" compile 'com.google.endpoints:endpoints-framework:2.0.5' compile project(':backend') kapt "com.google.dagger:dagger-compiler:${daggerVersion}" apt "com.google.dagger:dagger-compiler:${daggerVersion}" testCompile 'junit:junit:4.12' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "com.google.code.gson:gson:2.8.2" compile 'org.thymeleaf:thymeleaf:3.0.7.RELEASE' compile 'com.warrenstrange:googleauth:1.1.2' compile 'org.mindrot:jbcrypt:0.4' testCompile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" testCompile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" testCompile "org.mockito:mockito-core:2.+" testCompile "com.google.appengine:appengine-api-labs:${appengineVersion}" testCompile "com.google.appengine:appengine-api-stubs:${appengineVersion}" testCompile "com.google.appengine:appengine-tools-sdk:${appengineVersion}" testCompile "com.google.appengine:appengine-testing:${appengineVersion}" } appengine { stage { enableJarClasses = true } } repositories { mavenCentral() } compileKotlin{ kotlinOptions{ jvmTarget = 1.8 } } dokka { outputFormat = 'html' outputDirectory = file("${buildDir}/javadoc") } sourceSets { main.java.srcDirs += 'src/main/java' main.java.srcDirs += 'build/generated/source/kapt/main' main.kotlin.srcDirs += 'src/main/kotlin' } idea { module { sourceDirs += file("./build/generated/source/kapt/main") excludeDirs -= file("$buildDir") excludeDirs += file("$buildDir/dependency-cache") excludeDirs += file("$buildDir/libs") excludeDirs += file("$buildDir/tmp") } } 

EDIT - SOLUTION

Just to elaborate Jack's answer: I had to locate gradle-wrapper.properties and change the distribution url to:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip 

1 Answer 1

8

I came across the same issue. Use gradle 3.4(+) will solve it for me.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.