I don't know if is this the best way, but for me solved changing version of the kotlin.android plugin to 2.0.0.
id "org.jetbrains.kotlin.android" version "2.0.0"