13

While I'm trying to obfuscate simple DataLoader.class file in ProGuard I get this error:

Reading program directory [C:\Users\uzytkownik\Documents\NetBeansProjects\ProTest\build\classes\Files\DataLoader.class]
Warning: class [DataLoader.class] unexpectedly contains class [Files.DataLoader]
Warning: there were 1 classes in incorrectly named files.
         You should make sure all file names correspond to their class names.
         The directory hierarchies must correspond to the package hierarchies.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
         If you don't mind the mentioned classes not being written out,
         you could try your luck using the '-ignorewarnings' option.
Please correct the above warnings first.

Here is the project: http://www49.zippyshare.com/v/14668241/file.html

I will be grateful for your help.

Wicia
  • 575
  • 3
  • 9
  • 28

2 Answers2

13
Warning: class [META-INF/versions/9/module-info.class] unexpectedly contains class [module-info] 

This is the issue I had and I tried few options mentioned below:

  1. -keep class module-info
  2. -keepattributes Module*
  3. -dontwarn module-info

The option worked for me is 3.

Not sure why but it solves my problem and I am able to make the jar.

This issue comes when you upgrade something like I upgrade the spring-boot version and the project starts failing.

Please check the maven dependencies as well.

Atul
  • 3,043
  • 27
  • 39
5

With the options -injars and -libraryjars, you should specify the proper base directory (or jar) of your classes, just like a classpath. In this case: classes, not classes\Files\DataLoader.class.

See the ProGuard manual > Troubleshooting > Warning: class file ... unexpectedly contains class ...

Lonzak
  • 9,334
  • 5
  • 57
  • 88
Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106
  • 2
    can you provide an example of `-injars` with the proper base directory and input jar? I haven't found any example when looking into the docs – pixel Oct 01 '20 at 07:50