Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out which classes cannot be resolved by ProGuard Android

After adding ProGuard rules for all libraries I am using, I still get this warning:

Warning: there were 14 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)

I know that I can probably use the -dontwarn option to get rid of this warning, but therefore I need to know which packages/classes/interfaces cannot be resolved. Android does not support a global "-dontwarn".

In the log file I find so many Notes and Warnings, but none of them seem to relate the above message.

like image 561
muetzenflo Avatar asked Mar 09 '23 23:03

muetzenflo


1 Answers

If you receive a Warning: there were X unresolved references to classes or interfaces then look for lines in your build log that contain the word Warning, such as this:

Warning: com.package.Class1: can't find referenced class org.library.Class2

Lines like this will tell which classes ProGuard is trying to work on and which classes can't be found in the input jars. In the example above, class Class1 would reference Class2 of a library but Class2 was not found in the build path.

As you mentioned, you can simply add -dontwarn <class regex> to ignore those warnings but ideally you should check them one-by-one to make sure that your configuration is correct and all required dependencies are being imported correctly.

like image 89
Mike Laren Avatar answered Apr 06 '23 01:04

Mike Laren