After building the desktop app using `./gradlew p...
# compose-desktop
y
After building the desktop app using
./gradlew packageReleaseDmg
and running the generated DMG, Coil Compose (3.0.4) fails to load images. The issue occurs only in the release build. Images load correctly in debug builds. My compose plugin version: 1.7.3 I tried adding Coil to the ProGuard rules, but the issue is still remaining. what proguard rule should I add? For more details. See the thread
đź§µ 1
here is my configuration: 1. compose-proguard.pro File (ProGuard Rules):
Copy code
# Only keeps coroutines.swing classes
 -keep class kotlinx.coroutines.swing.** { *; }
2.build.gradle File:
Copy code
--
 
     // Shared Code Dependencies
     sourceSets {
 
          androidMain.dependencies {
             ---
                implementation(libs.ktor.client.android)
           }
 
         commonMain.dependencies {
 
                 ---
                 // Coil Image Loading
                 implementation(libs.coil.compose)        // Coil for Compose
                 implementation(libs.coil.network.ktor3)  // Coil + Ktor Networking
         }
 
         // Desktop-Specific Dependencies
         desktopMain.dependencies {
                 implementation(compose.desktop.currentOs)
                 implementation(libs.kotlinx.coroutines.swing)
                 implementation(libs.ktor.client.java)     // Ktor HTTP Engine for Desktop
         }
 
         appleMain.dependencies {
              implementation(libs.ktor.client.darwin)
       }
 }
 ---
 compose.desktop {
     application {
         ---
 
         // Release Build Settings
         buildTypes.release.proguard {
             obfuscate.set(true)
             configurationFiles.from(project.file("<http://compose-proguard.pro|compose-proguard.pro>"))
         }
     }
 }
m
“fails to load images” is not a very insightful error message.
a
try to include java.net.http module in native distribution. Kind of:
Copy code
compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            targetFormats(
                org.jetbrains.compose.desktop.application.dsl.TargetFormat.Dmg,
                org.jetbrains.compose.desktop.application.dsl.TargetFormat.Msi,
                org.jetbrains.compose.desktop.application.dsl.TargetFormat.Deb
            )
            packageName = "my_app"
            packageVersion = "1.0.0"
            modules(
                "java.sql",
                "java.net.http",
                "jdk.unsupported",
                "jdk.security.auth",
            )
        }
        buildTypes.release.proguard {
            obfuscate.set(true)
            configurationFiles.from(project.file("assemble/proguard-rules.pro"))
        }
    }
}
or run the app from IDE with release flags to get more details regarding the issue in IDE output.
c
I haven't tried this... but you seem to be missing rules from here? https://github.com/coil-kt/coil/blob/main/samples/shared/shrinker-rules.pro
also here is romains project which says works with proguard https://github.com/romainguy/kotlin-explorer (it doesn't use coil) but maybe you can cross reference the proguard setup
y
Thank you all for your help ! I tried using the
java.net.http
module in the native distribution and added the ProGuard rules suggested by
Colton Idle
, but the issue still isn't resolved. Here's the link to my repository for more details: https://github.com/yassineAbou/LLMS
đź‘€ 1
c
ill try to take a look at this at some point this week
y
Thank you Colton 🙏, I appreciate you making time for this