如何禁止ProGuard发出“也许这是程序方法"警告 [英] How to suppress 'Maybe this is program method' warnings from ProGuard

查看:258
本文介绍了如何禁止ProGuard发出“也许这是程序方法"警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将ProGuard与我的Android应用程序配合使用,并且正在运行,在我的构建日志中获取以下警告.我添加了适当的'-keep公共类com.foo.OtherClass {public static *; }'声明到我的proguard.cfg文件中,但仍然收到警告.我的应用程序运行良好,并且可以正确动态地访问该类.有可能抑制这些警告吗?

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(); }'

推荐答案

您可以通过在配置中明确提及该方法来避免这种情况:

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

这篇关于如何禁止ProGuard发出“也许这是程序方法"警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆