Mixing Java And Kotlin In Gradle Project, Kotlin Cannot Find Java Class

前端 未结 2 1260
别那么骄傲
别那么骄傲 2021-02-13 01:12

As the title says, I am trying to mix Java and Kotlin in a single project. There\'s a good example found here. mixed-java-kotlin-hello-world. Everything is working properly besi

2条回答
  •  旧时难觅i
    2021-02-13 01:28

    I had a similar issue and my java code was in the same source directory as the kotlin code

    My solution was adding this configuration in build.gradle.kts:

    configure {
        named("main") {
            java.srcDir("src/main/kotlin")
        }
    }
    

提交回复
热议问题