Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved Reference Kotlinx in IntellijIdea. Even after adding the library

I just wanted to taste Kotlin coroutines. Unfortunately, I haven't been able to use the library kotlinx in IntelliJ. I have downloaded the library through Maven.

  1. Tried invalidating caches.
  2. Rebuilt project.
  3. Tried using it in a fresh project.
  4. Even IntelliJ is suggesting kotlinx in auto-completion.
  5. Still it says unresolved reference

I have tried most of the solutions on the web. But nothing worked.

Here are the steps that I am exactly doing.

made a new project

Made a new project.

enter image description here

kotlinx is underlined since the library has not been added.

enter image description here

In project structure > modules > dependencies > add > library > maven Searched for the kotlinx library.

enter image description here

Downloaded the library.

enter image description here

Applied the settings.

enter image description here

kotlinx library is now visible in the External Libraries section.

enter image description here

Even the auto-completion is now suggesting kotlinx.

enter image description here

Still, nothing changes. The result is the same.

like image 311
nilTheDev Avatar asked Dec 31 '22 14:12

nilTheDev


1 Answers

I have found the answer in the Kotlin slack channel. And to solve this particular issue add org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0 instead of org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0.

However, it is generally a good idea to learn a build system like Gradleor Maven and using those in the project. It makes life a lot easier.

like image 182
nilTheDev Avatar answered Jan 04 '23 16:01

nilTheDev