Cannot sync Gradle Kotlin project with 2017.3 Public Preview

Answered

Using 2017.3 "Public Preview", build IU173.3415.22 which comes with Kotlin plugin version 1.1.60-eap-43-IJ2017.3-1, I cannot sync my Gradle project with IJ.

I get the error: 

Could not initialize class org.jetbrains.kotlin.kapt.idea.KaptModelBuilderService

The full console output of the build is:


FAILURE: Build failed with an exception.

* Where:
Initialization script '/tmp/ijinit.gradle' line: 16

* What went wrong:
A problem occurred evaluating initialization script.
> org.jetbrains.plugins.gradle.tooling.ModelBuilderService: Provider org.jetbrains.kotlin.kapt.idea.KaptModelBuilderService could not be instantiated

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

CONFIGURE FAILED

Total time: 0.494 secs
Could not initialize class org.jetbrains.kotlin.kapt.idea.KaptModelBuilderService

 

Unfortunately I don't know how to run the gradle sync with the --stacktrace option.

There was no error in the previous EAP version.

 

Gradle version used: 3.1

Kotlin version specified in the project: either 1.1.51, or 1.1.60-eap43

 

Full IntelliJ version information:

IntelliJ IDEA 2017.3 EAP (Ultimate Edition)
Build #IU-173.3415.22, built on October 25, 2017
IntelliJ IDEA EAP User
Expiration date: November 24, 2017
JRE: 1.8.0_152-release-1024-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-96-generic

 

0
4 comments

Upgrading Gradle does fix it indeed, but some other things in the Gradle build seem to break after upgrading. What is the minimum supported version of Gradle?

0
Avatar
Permanently deleted user

The same problem.

When I update my kotlin plugin from ver.1.1.51 to 1.1.60.

Even the projects without kotlin code have the same problem and can't execute 「gradle sync」 successfully.

Now I have to disable the kotlin plugin.

here is my environment:

Android Studio 2.3.1(162.3871768)

JDK internal

project:

gradle plugin 2.1.3

gradle wrapper 2.14.1-all

build sdk version  23.0.3

 

error detail:

Gradle sync failed: Could not initialize class org.jetbrains.kotlin.kapt.idea.KaptModelBuilderService
Consult IDE log for more details (Help | Show Log)

0
Avatar
Permanently deleted user

Hi,

 

I had the same issue and fixed it by updating the gradle version from 3.X to 4.1 in gradle-wrapper.properties file. I read it here: https://stackoverflow.com/questions/47418138/unable-to-load-class-kotlin-collections-collectionskt-error-when-trying-to-syn

 

In addition, remember to add this to your build.gradle file:

apply plugin: 'application'
mainClassName
= '[your_namespace].[your_arctifact]Kt'

where your_namespace is your package name and your_artifact the name of your application/main class.

1

Please sign in to leave a comment.