It seems like IDEA does not recognize java imports...
# announcements
a
It seems like IDEA does not recognize java imports in Kotlin
g
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
what is “java import”? Import of code from
java.*
package?
a
yes sir
I am able to compile it in gradle from command line
but IntelliJ does not recognize the imports in kotlin
g
You probably imported project in a some wrong way. Try do that again. Close the project and choose File -> Project from existing sources…
a
Ok, will do
g
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
will do
j
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
@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
Ideadev? Do you use not-stable version of Idea?
Use 1.2.50, 1.2.51 is not released officially
j
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
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
Yeh, first time we've seen it as well.