Whenever I run the runReleaseDistributable task I ...
# compose-desktop
z
Whenever I run the runReleaseDistributable task I get a ton of proguard errors that prevent the task from completing which doesn't seem normal
Copy code
Warning: there were 605 unresolved references to classes or interfaces.
there were 605 unresolved references to classes or interfaces.

         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (<https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass>)
Warning: there were 299 instances of library classes depending on program classes.
         You must avoid such dependencies, since the program classes will
         be processed, while the library classes will remain unchanged.
         (<https://www.guardsquare.com/proguard/manual/troubleshooting#dependency>)
there were 299 instances of library classes depending on program classes.

Warning: there were 6 unresolved references to program class members.
there were 6 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>)
Warning: there were 1 unresolved references to library class members.
there were 1 unresolved references to library class members.

         You probably need to update the library versions.
         (<https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedlibraryclassmember>)
m
Depending on your code and your dependencies this is normal. I added Apache POI to my code and ended up with over a thousand missing classes. Have you already added rules to your config files to keep more classes? This is a tedious task but the only real alternative would be to disable ProGuard for the release builds.
j
If these missing classes are from third-party libraries and your app works fine without ProGuard, then you can typically tell ProGuard to not warn about specific classes with the
-dontwarn
config option: https://www.guardsquare.com/manual/configuration/usage#dontwarn You can use wildcards in
-dontwarn
e.g.
-dontwarn org.apache.**
Some libraries will reference classes that aren't necessarily available and it doesn't matter to your apps use of the library e.g. they might try to use some class which might or might not be available and catch the exception to handle the case where it isn't available; and your app doesn't even use that part of the code. But in this case, ProGuard wouldn't know that it's OK to ignore the missing class. Some libraries might provide rules to add in their documentation; or consumer rules that are shipped in the library (but I don't know if the compose plugin uses the consumer rules yet?). You might find ProGuard rules for specific libraries already in use somewhere, e.g. for Apache POI there are these rules for Android which are probably also relevant for Compose Deskopt https://github.com/centic9/poi-on-android/blob/master/poitest/proguard-rules.pro You could also ignore all warnings with
-ignorewarings
but this is less safe because you might ignore warnings where you should rather add the missing classes.
m
You still have the problem to distinguish between the ones that you can safely ignore and the ones where you better keep the class. This problem would be less of an issue if every library would come with corresponding ProGuard rules but this may be common practice for Android but in the desktop world it is not. Even when this information is available you have to collect it yourself manually from different places at the moment. I, for example, did not know about the link for POI you have given above. (Thank you for that by the way cheers.)
👍 1
🍻 1
z
I'm not sure if my app will work without them though. The build never completes so I don't have a way to test it
d
@alexey.tsvetkov Can you please help with answer?