16

I created a new project from VCS (Kotlin and Gradle). I added three testImplementation() calls to the build.gradle.kts. IntelliJ didn't pickup the changes so I did File -> Invalidate caches / Restart and now Intellij shows every implementation() call and every testImplementation() call in red. In fact every line in every build.gradle.kts in every module is red.

Intellij has lost its mind. What do I have to do to restore IntelliJ's intelligence when it comes to kotlintest in Gradle?

Dean Schulze
  • 9,633
  • 24
  • 100
  • 165

5 Answers5

6

I started seeing this with AS 4.2.1. Invalidating caches and re-importing the project didn't work for me. I found this article on the JetBrains issue tracker where people found that they had an extraneous JDK set in the project settings. While I did not have an extraneous JDK set in my project structure, I tried changing the JDK from the AS embedded version to an alternate AdoptOpenJDK 1.8 version I had installed. After switching to that version all the red went away and everything is resolving as expected. I was then able to switch the SDK back to the embedded version and everything continued working as expected. When switching back to the embedded version I did notice a brief message in the progress bar at the bottom of AS saying that it was processing a JDK 11. I'm not sure where that's coming from, but it does seem to be in line with what others in the JetBrains issue were talking about.

Jordan
  • 4,133
  • 1
  • 27
  • 43
2

The way I was finally able to solve this was with File -> Invalidate caches / Restart. It must have been cache corruption.

Dean Schulze
  • 9,633
  • 24
  • 100
  • 165
0

What do I have to do to restore IntelliJ's intelligence when it comes to kotlintest in Gradle?

Re-import the project: File | New | Project from Existing Sources action and select build Gradle file to load the project from.

Andrey
  • 15,144
  • 25
  • 91
  • 187
0

Change your jdk.

Go to File>Project Structure > SDK Location > GradleSettings

Change the Gradle JDK to use the embedded or a compatible JDK (Azul JDK) if you're using a MAC.

Then Invalidate and refresh cache after deleting the .idea and .gradle files.

Narendra_Nath
  • 4,578
  • 3
  • 13
  • 31
0

Adding the following line to gradle.properties fixed the issue in my case

org.gradle.dependency.verification=lenient

Related issue https://youtrack.jetbrains.com/issue/KTIJ-21452

Dmitri Chernysh
  • 260
  • 1
  • 7