Pablo
01/17/2025, 10:55 PMproguard
to my Compose Desktop
app for obfuscating the code. I got a lot of proguard
errors after enabling it, but after a lot of research I get rid of all of them adding a lot of proguard
rules. Now the release distributable builds, and after installing it correctly, when I try to run it gives this error: Failed to launch JVM
and closes. I can't know why because I don't find any log on the system with information about what is happening. Any idea? I'm adding how I enable proguard in the thread.Pablo
01/17/2025, 10:55 PMbuildTypes.release.proguard {
isEnabled.set(true)
version.set("7.5.0")
configurationFiles.from(project.file("<http://compose-desktop.pro|compose-desktop.pro>"))
}
Michael Paus
01/18/2025, 8:38 AMPablo
01/18/2025, 9:45 AMTask :composeApp:runReleaseDistributable
Exception in thread "main" java.lang.ClassFormatError: Invalid index 4 in LocalVariableTable in class file androidx/compose/ui/unit/IntOffset
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at androidx.compose.ui.graphics.painter.BitmapPainter.<init>(BitmapPainter.kt:73)
at org.jetbrains.compose.resources.ImageResourcesKt.painterResource(ImageResources.kt:44)
at com.mypackage.ComposableSingletons$MainKt$lambda-1$1.invoke(main.kt:1046)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:116)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
at androidx.compose.ui.window.Application_desktopKt$application$1$1.invoke(Application.desktop.kt:117)
at androidx.compose.ui.window.Application_desktopKt$application$1$1.invoke(Application.desktop.kt:116)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:116)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1$1.invoke(Application.desktop.kt:233)
at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1$1.invoke(Application.desktop.kt:232)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1.invoke(Application.desktop.kt:223)
at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1.invoke(Application.desktop.kt:221)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
at androidx.compose.runtime.ActualJvm_jvmKt__ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:36)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(Unknown Source)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3595)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime(Composer.kt:3522)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:743)
at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:1122)
at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:649)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:635)
at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2.invokeSuspend(Application.desktop.kt:221)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Pablo
01/18/2025, 10:52 AMPablo
01/18/2025, 10:53 AMPablo
01/18/2025, 11:05 AMWarning: there were 231 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
Michael Paus
01/18/2025, 11:54 AMbuildTypes.release {
proguard {
version.set("7.6.1")
isEnabled.set(false) // Don't set to true until <https://github.com/Guardsquare/proguard/issues/443> is fixed.
optimize.set(false)
obfuscate.set(false)
configurationFiles.from(project.file("<http://compose-desktop.pro|compose-desktop.pro>"))
}
}
Recent ProGuard versions are buggy and I just don’t have that much time to waste. I decided to trade a larger installer bundle agains a reliably working application.Pablo
01/18/2025, 1:25 PMPablo
01/18/2025, 1:25 PMPablo
01/18/2025, 1:26 PMMichael Paus
01/18/2025, 3:35 PMClassFormatError
which looks very suspicious to me. ProGuard fiddles with the class files itself but does not always get it right. I don’t know whether that’s the case here but it looks like it.Pablo
01/18/2025, 4:20 PMPablo
01/18/2025, 5:05 PM