如何覆盖其他 proguard 规则
我希望从thirdpartylib.aar
中删除带有以下签名的类A
package com.example
class A : Base {}
,该带有其自己的proguard/r8规则,其中一个是
- 保存公共类 *扩展了com.example .base
但是,我希望删除A类,因为我知道这不会使用。我如何实现这一目标。
下面的规则不起作用,因为为什么areyoukeping
散发出上述规则。
-keep class!com.example.a
我试图弄清楚proguard规则是否优先。是否可以将规则声明为更高的优先级?提前致谢。
I wish to remove a class A with the following signature
package com.example
class A : Base {}
from a thirdpartylib.aar
that comes with its own set of proguard/r8 rules one of which is
-keep public class * extends com.example.Base
however I wish to remove a class A since I know this wouldn't be used. How do I achieve this override.
The rule below doesn't work, since whyareyoukeeping
emits the rule above.
-keep class !com.example.A
I'm trying to figure out if there is a priority to proguard rules. Is it possible to declare a rule as higher priority? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,规则的“优先”是最广泛的规则优先。因此,如果一条规则保留某些东西,则不可能将另一个规则远离。
目前,覆盖
jar
's/aar
's中包含的规则的唯一方法是分叉并替换规则。可以通过替换版本的本地Maven存储库来实现这一目标。但是,AGP 7.3将包含库中的重大规则的功能,请参见 https://issuetracker.google.com/37097003 < /a>有关更多详细信息。可以通过AGP 7.3金丝雀尝试一下。
First of all the "priority" of rules is that the most broad rule takes precedence. So if a rule keeps something it is not possible for another rule to take that keep away.
Right now the only way to override the rules included in a
jar
's/aar
's is to fork it and replace the rules. One can do that through a local maven repository with a replacement version.However, AGP 7.3 will include a feature for overriding rules in libraries, see https://issuetracker.google.com/37097003 for more details. It is possible to try out this through the AGP 7.3 canaries.