3

I generate a skeleton kotlin application via gradle init --dsl kotlin -> load the project into intellij and I receive following error. screenshot attached.

Type mismatch : inferred type is kotlin.String but java.lang.String was expected.

I have tried various steps of invalidating caches/restart. removing .gradle, .idea, ~/.gradle etc. refreshing gradle projects, stopping gradle daemon. refreshing intellij project (Removing ~/.intellijIDea../system dir). However, none have helped. please tell me what else can I do ?

as I said, I generated project via gradle init --dsl kotlin. gradle version 5.2.1, kotlin plugin version 1.3.20. all latest. intellij idea is at 2018.3 version. For starters, build.gradle.kts is as follows:

plugins {
    // Apply the Kotlin JVM plugin to add support for Kotlin on the JVM.
    id("org.jetbrains.kotlin.jvm").version("1.3.20")

    // Apply the application plugin to add support for building a CLI application.
    application
}

repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

dependencies {
    // Use the Kotlin JDK 8 standard library.
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

    // Use the Kotlin test library.
    testImplementation("org.jetbrains.kotlin:kotlin-test")

    // Use the Kotlin JUnit integration.
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}

application {
    // Define the main class for the application.
    mainClassName = "info.XXX.YYY"
}

enter image description here

1 Answer 1

7

on stack overflow, I landed on a link where it informed to use oracle jdk instead of openjdk. installed oracle jdk -> invalidate cache/restart, did it for me.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! It helped. BTW not only the Oracle JDK works but at least the JBR (JetBrains Runtime) bundled within Intellij Idea works fine as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.