I've built a fat jar of the tesseract basic example of 7.9 MB (see also this SO question). Now I want to shrink its size using ProGuard. Using this standard gradle task with the addition of keep 'class org.bytedeco.javacpp.** {*;}'
and dontwarn 'org.bytedeco.javacpp.**'
works just fine (7.6 MB jar size) but I get a lot of warnings when running the jar:
Warning: Loader.putMemberOffset(): java.lang.ClassNotFoundException: org.bytedeco.tesseract. ...
Warning: Loader.putMemberOffset(): java.lang.ClassNotFoundException: org.bytedeco.leptonica. ...
(following this guide leads to the same result).
I can prevent these warnings by keeping tesseract
and leptonica
too:
keep 'class org.bytedeco.tesseract.** {*;}'
keep 'class org.bytedeco.leptonica.** {*;}'
which results in a minimally larger jar (7.7 MB), but as the program seems to work OK with the warnings I was wondering if there's another way, e.g. by keeping not everything from org.bytedeco
.
It's a really petty issue, but maybe there's an easy solution for it (the additional 0.1 MB is not a problem at all, just trying to get a little better understanding of javacpp, which is a really great library).