Explicility including a library solve some warnings

I use Proguard for minimizing Kotlin/JVM application (desktop)

I use Shadow Jar for building the uber JAR (with all dependencies included)

I already injars for the input uber Jar file, libraryjars for the JDK modules, injars for the sourceSets.main.get().compileClasspath

and the minimized JAR by Proguard works really well, one of the dependencies is OkHttp which depends on Okio, the latest versions of Okio do not require rules so I didn’t include any rules, and the application works just like expected without any runtime exceptions or errors, though once I add a library that also depends on Okio, I will get one Proguard warning that causes build failure.

Okhttp depends on Okio 3.9.0 (okhttp/gradle/libs.versions.toml at c85c3dbbee94e2bb8ed86ed29da0148842bb493e · square/okhttp · GitHub), The library I included also depends on Okio 3.9.0 (knbt/gradle.properties at 6580e06fd3cda898989f1a5cecf4694579c134df · BenWoodworth/knbt · GitHub)

The issue happens as soon as I include the other library that also depends on Okio.

Warning: okio.internal.ZipFilesKt$readEntry$1: can't find enclosing method 'okio.internal.ZipEntry readEntry(okio.BufferedSource)' in program class okio.internal.ZipFilesKt

Here are the injars:

-injars /Users/user/.gradle/caches/modules-2/files-2.1/net.benwoodworth.knbt/knbt-jvm/0.11.5/e9ba19312573c4943a8047d14a4635a46f4ea323/knbt-jvm-0.11.5.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-core-jvm/1.7.0/d12521a5361493aa8a3fb43b2d729b5edae1b100/kotlinx-serialization-core-jvm-1.7.0.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-json-jvm/1.7.0/f4a6f6e002edb22725309b829bacdb5ac2fb4630/kotlinx-serialization-json-jvm-1.7.0.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.9.0-RC/3b5aa024984a3fd1a5bd201dffc43ec4b8ae176f/kotlinx-coroutines-core-jvm-1.9.0-RC.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/4.12.0/2f4525d4a200e97e1b87449c2cd9bd2e25b7e8cd/okhttp-4.12.0.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio-jvm/3.6.0/5600569133b7bdefe1daf9ec7f4abeb6d13e1786/okio-jvm-3.6.0.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.9.10/c7510d64a83411a649c76f2778304ddf71d7437b/kotlin-stdlib-jdk8-1.9.10.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.9.10/bc5bfc2690338defd5195b05c57562f2194eeb10/kotlin-stdlib-jdk7-1.9.10.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.0.0/b48df2c4aede9586cc931ead433bc02d6fd7879e/kotlin-stdlib-2.0.0.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/com.formdev/flatlaf/3.4.1/59161ce93728eaec725a26d646f7eff1d363decd/flatlaf-3.4.1.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/com.formdev/flatlaf-extras/3.4.1/4b16d03de9eea99f9de038926198ece2ae653bcf/flatlaf-extras-3.4.1.jar
-injars /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/23.0.0/8cc20c07506ec18e0834947b84a864bfc094484e/annotations-23.0.0.jar

A solution is to explicitly include it:

implementation("com.squareup.okio:okio:3.9.0")

The -injars now after this solution:

-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/net.benwoodworth.knbt/knbt-jvm/0.11.5/e9ba19312573c4943a8047d14a4635a46f4ea323/knbt-jvm-0.11.5.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-core-jvm/1.7.0/d12521a5361493aa8a3fb43b2d729b5edae1b100/kotlinx-serialization-core-jvm-1.7.0.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-json-jvm/1.7.0/f4a6f6e002edb22725309b829bacdb5ac2fb4630/kotlinx-serialization-json-jvm-1.7.0.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.9.0-RC/3b5aa024984a3fd1a5bd201dffc43ec4b8ae176f/kotlinx-coroutines-core-jvm-1.9.0-RC.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/4.12.0/2f4525d4a200e97e1b87449c2cd9bd2e25b7e8cd/okhttp-4.12.0.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio-jvm/3.9.0/eaa4f7858a1e80908b1a2e861e662edd7c6cbbb5/okio-jvm-3.9.0.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.8.21/67f57e154437cd9e6e9cf368394b95814836ff88/kotlin-stdlib-jdk8-1.8.21.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.8.21/7473b8cd3c0ef9932345baf569bc398e8a717046/kotlin-stdlib-jdk7-1.8.21.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.0.0/b48df2c4aede9586cc931ead433bc02d6fd7879e/kotlin-stdlib-2.0.0.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/com.formdev/flatlaf/3.4.1/59161ce93728eaec725a26d646f7eff1d363decd/flatlaf-3.4.1.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/com.formdev/flatlaf-extras/3.4.1/4b16d03de9eea99f9de038926198ece2ae653bcf/flatlaf-extras-3.4.1.jar
-injars /Users/ellet/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/23.0.0/8cc20c07506ec18e0834947b84a864bfc094484e/annotations-23.0.0.jar

It looks like okio-jvm-3.6.0.jar changed to okio-jvm-3.9.0.jar. Though I’m not sure why.

Previously it was a dependency of both Okio and that other library, I can still use Okio even if I don’t explicitly include it, the solution above solved the problem, though I’m interested in knowing why this is a fix.

Maybe or probably I missed something?

Not directly related: Sometimes Proguard says some usages are either missing or unresolved, though usually, it’s a dependency of a library, a solution usually is to either ignore the warnings or explicitly include the dependencies of the library that will cause the issue once included.