Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProGuard warnings: there were 7 unresolved references to program class members

Tags:

java

jar

proguard

ProGuard stops with a lot of warnings:

Warning: there were 1221 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. (http://proguard.sourceforge.net/manual/troubleshooting. html#unresolvedclass)

Warning: there were 37 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. (http://proguard.sourceforge.net/manual/troubleshooting. html#dependency) Warning: there were 7 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile the code. (http://proguard.sourceforge.net/manual/troubleshooting. html#unresolvedprogramclassmember)

Error: Please correct the above warnings first.

But my jar runs correctly. I am not quite familiar with proguard setting. Any suggestion?

like image 927
Michael SM Avatar asked Jan 14 '15 02:01

Michael SM


3 Answers

I'm going to quote a very relevant part of your question (namely the answer).

If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options

So, run it with -dontwarn since my jar runs correctly.

Documented (per your question) here there is also the option -libraryjars which you can use if you have external libraries you want to add.

like image 157
Elliott Frisch Avatar answered Nov 16 '22 06:11

Elliott Frisch


The best thing to do here is adding the libraries in progyard configuration file. At the top of it, just after the input and output jar paths, put lines like this one, one for each library jar you use:

-libraryjars 'path/to/jar/file.jar'

This tells proguard to load the missing classes from the specified jars.

like image 3
Iamsomeone Avatar answered Nov 16 '22 06:11

Iamsomeone


There are warnings above like

Warning: class A: can't find referenced class B

For which you can either use -keep class com.package.** { *; } to prevent it from being obfuscated, or if you're sure that this is not a problem, you can use -dontwarn com.package.**.

like image 3
EpicPandaForce Avatar answered Nov 16 '22 05:11

EpicPandaForce