Project isn't linked with Gradle

Right click on build.gradle.kts > Import Gradle project should help. No need to add empty build.gradle nor set rootProject.buildFileName.


I had similar issue.

I have Added empty build.gradle file in the root of the project that uses Gradle Kotlin DSL (projects may use build.gradle.kts for config, however empty build.gradle file is required by grade to function correctly)

Update:

You should also add this line to settings.gradle.kts file:

rootProject.buildFileName = "build.gradle.kts"