Using the currently stable versions (IntelliJ IDEA 2017.3.4, Gradle 4.5.1 and Kotlin 1.2.21) on Windows 10, I was able to resolve it by following these steps:
- Exit IDEA.
- If needed, update the Gradle wrapper. Repeat the following command until Gradle says it is up to date:
./gradlew wrapper
- Delete folder
.gradle
- Start IDEA.
It still worked after I restarted IDEA.