https://kotlinlang.org logo
Title
a

ananthraghuraman

07/02/2018, 2:22 AM
It seems like IDEA does not recognize java imports in Kotlin
g

gildor

07/02/2018, 2:31 AM
It should be fine, hard to say something without code or your build file. Maybe you could share some sample project
above is the code (two files, one is app.kt and the other is build.gradle)
when imported into IntelliJ, it fails to recognize java imports
I am using 12.41 kotlin plugin and 1.2.21 Kotlin
g

gildor

07/02/2018, 2:43 AM
what is “java import”? Import of code from
java.*
package?
a

ananthraghuraman

07/02/2018, 2:46 AM
yes sir
I am able to compile it in gradle from command line
but IntelliJ does not recognize the imports in kotlin
g

gildor

07/02/2018, 2:49 AM
You probably imported project in a some wrong way. Try do that again. Close the project and choose File -> Project from existing sources…
a

ananthraghuraman

07/02/2018, 2:49 AM
Ok, will do
g

gildor

07/02/2018, 2:51 AM
And then choose “import project from external model” -> Gradle
also it can be misconfigured JDK,you can check in project settings that jdk is pointing on valid location
a

ananthraghuraman

07/02/2018, 2:53 AM
will do
j

JoeHegarty

07/02/2018, 2:57 AM
One other thing to check, are you sure IntelliJ has the same version of the Kotlin plugin as you are using in Gradle?
Tools -> Kotlin -> Configure Kotlin Plugin Updates
We had a really weird issue where imports were not showing up and the debugger wouldn't start last week, and we tracked it down to that.
1.2.21
from your gradle is pretty old.
1.2.50
is latest so you might want to bump that and then ensure you have
1.2.50
in IntelliJ
a

ananthraghuraman

07/02/2018, 3:01 AM
@Andrey, checked JDK, ensured project is re-imported properly - still same issue
@JoeHegarty Yeah, I have an older version because the latest kotlin-stdlib-jdk8 wanted 1.2.51 version of kotlin-stdlib and 1.2.51 version of everything else. This bleeding edge version seems to be in ideadev
But, I will try again
g

gildor

07/02/2018, 3:04 AM
Ideadev? Do you use not-stable version of Idea?
Use 1.2.50, 1.2.51 is not released officially
j

JoeHegarty

07/02/2018, 3:06 AM
Yeh, and as I say, we had an issue where the debugger wouldn't start, imports wouldn't resolve etc. And it was because Gradle/Maven were at 1.2.50 and the plugin was a previous version. It took several folks on our team out for like half a day.
Need to dig into it a bit more.
g

gildor

07/02/2018, 3:06 AM
I never had issues with different versions of Kotlin compiler/stdlib and idea plugin. But it can be a bug on a specific version of plugin itself
j

JoeHegarty

07/02/2018, 3:06 AM
Yeh, first time we've seen it as well.