compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

packageReleaseMsi execution failed

Open marzaha opened this issue 2 years ago • 3 comments

gradle.properties file :

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
kotlin.code.style=official
kotlin.version=1.9.21
compose.version=1.5.11

build.gradle.kts file :

import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
    kotlin("jvm")  
    id("org.jetbrains.compose")
}

group = "com.dev"
version = "1.0.0"

repositories {
    google()
    mavenCentral()
    maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

dependencies {
    implementation(compose.desktop.currentOs)
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.7.3")
}

compose.desktop {
    application {
        mainClass = "MainKt"

        nativeDistributions {
            targetFormats(TargetFormat.Msi)
            packageName = "MyApp"
            packageVersion = "1.0.0"

            appResourcesRootDir.set(project.layout.projectDirectory.dir("libs"))

            buildTypes.release.proguard {
                obfuscate.set(false)
                configurationFiles.from(project.file("proguard-rules.pro"))
            }

            windows {
                shortcut = true
                menuGroup = "MyApp"
                iconFile.set(project.file("src/main/resources/icon.ico"))
            }
        }
    }
}

External tool execution failed:

  • Command: [C:\Users\PC\.jdks\corretto-17.0.10\bin\java.exe, -cp, "C:\Users\PC\.gradle\caches\modules-2\files-2.1\com.guardsquare\proguard-gradle\7.2.2
  • Working dir: []
  • Exit code: 1
  • Standard output log: E:\MyApp\build\compose\logs\proguardReleaseJars\java-2024-02-23-10-09-05-out.txt
  • Error log: E:\MyApp\build\compose\logs\proguardReleaseJars\java-2024-02-23-10-09-05-err.txt

Unexpected error java.io.IOException: Please correct the above warnings first. at proguard.Initializer.execute(Initializer.java:544) ~[proguard-base-7.2.2.jar:7.2.2] at proguard.pass.PassRunner.run(PassRunner.java:24) ~[proguard-base-7.2.2.jar:7.2.2] at proguard.ProGuard.initialize(ProGuard.java:328) ~[proguard-base-7.2.2.jar:7.2.2] at proguard.ProGuard.execute(ProGuard.java:130) ~[proguard-base-7.2.2.jar:7.2.2] at proguard.ProGuard.main(ProGuard.java:623) [proguard-base-7.2.2.jar:7.2.2]

marzaha avatar Feb 23 '24 02:02 marzaha

@marzaha Can you please create a minimal reproducible sample project on GitHub?

dima-avdeev-jb avatar Feb 28 '24 15:02 dima-avdeev-jb

@dima-avdeev-jb i Have the same problem when "running or creating release distributable" and i have reduced the source of the problem to adding "implementation(compose.material3)" in a desktop multiplatform with jetbrainscompose = "1.6.1" kotlin = "1.9.23" Its very similar to this #2393 but with this log file java-2024-03-15-19-42-32-out.txt

Minimal Reproducible : https://github.com/PMARZV/MinimalReproducibleMsiReleaseDistributionFailing

-Run or Create Release distributable with Material 3 dependency. (It will fail with the java.io.IOException: Please correct the above warnings first and the log file)

-Then, try again the same but with the Material 3 dependency deactivated (it doesn't fail, it runs or creates perfectly)

PMARZV avatar Mar 15 '24 18:03 PMARZV

Hello,

I had a case similar to yours.

As you can see in the error message, we need to resolve the previous warnings.

In the log "java-2024-03-15-19-42-32-out.txt", we can see that the warnings are for missing references. Example : Warning: kotlinx.datetime.serializers.DayOfWeekSerializer: can't find referenced class kotlinx.serialization.KSerializer You'll need to add : kotlin("plugin.serialization") version "1.9.22"

You'll need to check all the warnings and add the necessary libraries.

For your information, if you're missing a java module library such as : Warning: org.apache.lucene.index.ByteSlicePool: can't find referenced method 'int get(byte[],int)' in library class java.lang.invoke.VarHandle As the "java.lang" library is part of the "java.base" module, you need to use the following method to tell proguard that this module is required : Tutorial : Native_distributions_and_local_execution, Section : configuring-included-jdk-modules

compose.desktop {
    application {
        nativeDistributions {
            modules("java.base")
            // alternatively: includeAllModules = true
        }
    }
}

Xinerfapre avatar Apr 20 '24 16:04 Xinerfapre

Warning: there were 2 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedprogramclassmember)
Unexpected error
java.io.IOException: Please correct the above warnings first.
	at proguard.Initializer.execute(Initializer.java:544) ~[proguard-base-7.2.2.jar:7.2.2]
	at proguard.pass.PassRunner.run(PassRunner.java:24) ~[proguard-base-7.2.2.jar:7.2.2]
	at proguard.ProGuard.initialize(ProGuard.java:328) ~[proguard-base-7.2.2.jar:7.2.2]
	at proguard.ProGuard.execute(ProGuard.java:130) ~[proguard-base-7.2.2.jar:7.2.2]
	at proguard.ProGuard.main(ProGuard.java:623) [proguard-base-7.2.2.jar:7.2.2]

How is the plugin managing to pass in inconsistent classes? Even if I blow away the build directory, I get the same result reproducibly.

hakanai avatar Aug 01 '24 20:08 hakanai

Hi,

I don't know if it manage, I think it search dependences of dependences of project and if you don't have add dependences of dependences, you need to add it. Before your warning, you must have an other like this : Warning: kotlinx.datetime.serializers.DayOfWeekSerializer: can't find referenced class kotlinx.serialization.KSerializer

As I said in my previous message, you need to add his dependence : kotlin("plugin.serialization") version "1.9.22". That's how I solved my problem.

Hope it solves your problem.

Xinerfapre avatar Aug 09 '24 18:08 Xinerfapre

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Aug 26 '24 13:08 okushnikov