Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress 'Maybe this is program method' warnings from ProGuard

Tags:

proguard

I'm using ProGuard with my Android application and I'm running getting the warnings below in my build log. I've added the appropriate '-keep public class com.foo.OtherClass { public static *; }' statement to my proguard.cfg file, but I still get the warnings. My app runs fine and is dynamically accessing the class correctly. Is it possible to suppress these warnings?

[proguard] Note: com.foo.MyClass accesses a method 'getInstance()' dynamically
[proguard]       Maybe this is program method 'com.foo.OtherClass { com.foo.OtherClass getInstance(); }'
like image 225
ThomasW Avatar asked May 20 '11 07:05

ThomasW


2 Answers

You can avoid it by explicitly mentioning the method in the configuration:

-keep class com.foo.OtherClass { com.foo.OtherClass getInstance(); }

Alternatively, you can suppress notes on a class:

-dontnote com.foo.MyClass
like image 72
Eric Lafortune Avatar answered Oct 19 '22 12:10

Eric Lafortune


You suppress all messages of type Note by adding the following line:

-dontnote **
like image 6
Kirill Rakhman Avatar answered Oct 19 '22 14:10

Kirill Rakhman