https://kotlinlang.org logo
Title
t

tiwiz

08/08/2018, 6:57 AM
Hello everyone, we found a strange issue migrating from Kotlin 1.2.51 to 1.2.60 (always present with AGP 3.1.3, 3.1.4, 3.2.0-beta04 and 3.2.0-beta05, and android extensions plugin):
exception: java.lang.ClassCastException: java.util.Collections$UnmodifiableCollection cannot be cast to java.util.Set
    at org.jetbrains.kotlin.android.synthetic.AndroidComponentRegistrar.registerProjectComponents(AndroidComponentRegistrar.kt:154)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:179)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:117)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:413)
I couldn't really find anything on the web, we tried to refactor away some problematic libraries like Guava, but no luck 😕
g

gildor

08/08/2018, 7:01 AM
@myanmarking also had this problem Don’t know, does he solve it or not
Looks like some incompatibility with Android plugin, I would check that you have 1.2.60 plugin in all your plugins
Also work for me on 3.2.0-beta05
t

tiwiz

08/08/2018, 7:18 AM
I'll try with beta06 right now, I did not get an update so far
g

gildor

08/08/2018, 7:20 AM
sorry, bet05, just mistyped
t

tiwiz

08/08/2018, 7:52 AM
Thanks @gildor - I honestly have no idea on which other library can interfere with Kotlin 1.2.60
g

gildor

08/08/2018, 7:54 AM
It’s not a library, it’s some error during build. Problem of Kotlin Plugin for Android
j

JoseF

08/08/2018, 8:38 AM
Are you using any annotation processor?
g

gildor

08/08/2018, 8:44 AM
Looks like something related to android-extensions
t

tiwiz

08/08/2018, 8:56 AM
@JoseF not in the module that crashes the build - @gildor I couldn't tell, we had the same feeling, but it's complex to pin point the source of the issue
👍 1
I found the solution... We were using
kotlin-stdlib-jdk7
in one of the modules, switching to
kotlin-stdlib
fixed the issue.