I’m not sure if this is the right channel, but I r...
# gradle
r
I’m not sure if this is the right channel, but I recently upgraded a library I own from Kotlin 1.5.30 to 1.6.10, along with the kotlin-gradle plugin, and am using JVM 11 and Gradle 7.0.2. Now I have a consumer app of this library which is now failing to compile because it’s not recognizing a bunch of interface/companion object properties. The consumer app uses Kotlin 1.6.10 and the same gradle plugin and JVM. Everything was working with 1.5.30 and the only thing I changed was the Kotlin version. Here’s an example: In the library, I have this object:
Copy code
object Scopes {
  fun serial(): CoroutineScope = CoroutineScope(...)
}
In the consumer app of the library, I’m getting this new error:
Scopes.serial() -> Unresolved reference: serial
Java 8 Bytecode from consumer app:
Copy code
public final class Scopes {
    @NotNull
    public static final Scopes INSTANCE = new Scopes();
However, I call Scopes.INSTANCE.serial() it works. Additionally, I’m getting errors with accessor properties in interfaces not being recognized in the consumer app, even though the decompiled java bytecode says it’s there. Is there an additional compiler configuration I’m missing?
a
just a guess: do you set
apiVersion
or
languageVersion
(docs) anywhere? Or
jvmTarget
?
r
Yeah I have:
Copy code
kotlinOptions {
        jvmTarget = '11'
    }
But no apiVersion/languageVersion specified explicitly
t
Is it also failing with Kotlin 1.6.20?
a
that should be fine... is the error happening just in IntellIJ, or also when compiling from the command line?
r
@tapchicoma Wow thanks, upgrading to 1.6.20 fixed it. I should have tried that to begin with. Do you have any idea why this was happening in 1.6.10? I am not familiar with the details of the build system. @Adam S Good question, this was happening with gradle outside of Android Studio.
👍 1
t
Do you have any idea why this was happening in 1.6.10?
Hard to say without reproducer project
r
The actual root cause ended up being an r8 version issue when shrinking the library that I had upgraded to 1.6.0. I followed this post and the issue resolved: https://stackoverflow.com/questions/70569804/kotlin-1-6-0-breaks-proguard
👍 2