Skip to content Skip to sidebar Skip to footer

Kapt3: Java.io.file Cannot Be Cast To Java.lang.string

There is an exception when using apply plugin: 'kotlin-kapt' and running Gradle to build my app: Caused by: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.S

Solution 1:

It turns out that I've been mis-applying Realm plugin, so that the issue is in order of plugin application. Realm's plugin should be applied after Kotlin's ones:

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

That solved the issue for me.

Post a Comment for "Kapt3: Java.io.file Cannot Be Cast To Java.lang.string"