Proguard does not delete specific classes

Everything

I use proguard to obfuscate a scala application.

At this moment I use very little of the scala library, but still my bank is ~ 300 KB, 99% of them are scala-library classes.

Using the -whyareyoukeeping parameter, I see that it supports any class that overrides java.lang.Object methods, such as "toString" or "equals". for instance

scala.Some is invoked by scala.Some.equals (300:300) implements java.lang.Object.equals is a library method. 

And so scala. Some class is preserved, although I do not use it in my code.

Is there a way to fix this, so that I only save the classes that I use in my code?

Thanks Amir

+4
source share
1 answer

ProGuard's answer to -whyareyoukeeping sometimes contains circular reasoning, unfortunately. However, the shrink operation is correct. The class is not saved because it overrides equals (), but since it is actually referenced by some other class that is required. You can get a better experience by requesting other classes.

Even a small part of Scala can drag and drop many base classes due to transitive dependencies (often surprising at first sight). The final size is 300 thousand. It does not seem ordinary, compared with the original size of several megabytes.

+1
source

Source: https://habr.com/ru/post/1502782/


All Articles