Error: Could not find or load main class MainKt

2.2k views Asked by At

In Multiplatform project, I want to use main function inside jvmMain to test the library I’m working on, but when I’m trying to run this it returns an error Error: Could not find or load main class MainKt for following function in Main.kt

fun main() {
    println("Hello World!")
} 

I've got Main.kt file in a root directory of my module, but putting it under some package is also throwing this error.

I'm using Java 8 JDK: enter image description here

Are there any additional steps I should make to be able to use main function?

EDIT: I did additional checks and I found out that when in the project I have android target then in the jvm main function I’m getting this error above. When I’m creating a new project with exactly the same configuration, but without android target it’s working properly, main function compiles and it is printing a message. Any guess what is causing this problem?

0

There are 0 answers