https://kotlinlang.org logo
#announcements
Title
# announcements
d

dave

11/29/2017, 9:42 AM
Gradle question: I'm upgrading a project to 1.2 and all of a sudden I've got a errors because I'm calling static java methods and this is now prohibited. On further inspection, it looks like my IntelliJ project is being imported with a targetPlatform of 1.6. Any idea of the gradle magic to fix this? I've already got
Copy code
sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
in my gradle file, and the project SDK is set correctly to 1.8. Is there another flag I'm missing for
targetPlatform
?
d

dragas

11/29/2017, 10:33 AM
I'm calling static java methods and this is now prohibited
Is it? I can't seem to find that in http://kotlinlang.org/docs/reference/whatsnew12.html
d

dave

11/29/2017, 11:02 AM
I think it's changed from a warning to an error - then again, I am upgrading a project from 1.1.X to 1.2.0 so I'm not sure when exactly that changed.
c

Czar

11/29/2017, 11:06 AM
You have to set kotlin compile target to 1.8
d

dave

11/29/2017, 11:08 AM
yep - this was my problem! 🙂
c

Czar

11/29/2017, 11:08 AM
Copy code
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
    kotlinOptions {
        // ...
    }
}
d

dave

11/29/2017, 11:09 AM
thanks - I actually already fixed it (see the next message below my original question) 🙂
c

Czar

11/29/2017, 11:10 AM
Oh, sorry, I'm using my mobile at the moment and missed it
d

dave

11/29/2017, 11:27 AM
Also annoying on slack - you can't upload an image to a thread...
c

Czar

11/29/2017, 11:35 AM
I use snaggy for that, but I too would've liked to have the functionality built-in