使用proguard时如何保留/排除特定的包路径? [英] How to keep/exclude a particular package path when using proguard?
问题描述
我想从 ProGuard 中排除一些文件路径.示例 com.myapp.customcomponents
I want to exclude some file paths from ProGuard. Example com.myapp.customcomponents
我该怎么做?我讨厌为此目录中的每个自定义组件文件放置 -keep 标志.
How can I do this? I hate to be placing -keep flags for every single custom component file I have in this directory.
我尝试了以下方法,但不起作用:
I have tried the following but it doesn't work:
-keep public class com.myapp.customcomponents.*
推荐答案
您没有指定它不起作用的方式.您的配置保留指定包中所有公共类的名称:
You don't specify in what way it doesn't work. Your configuration keeps the names of all public classes in the specified package:
-keep public class com.myapp.customcomponents.*
以下配置保留指定包及其子包中所有公共类的名称:
The following configuration keeps the names of all public classes in the specified package and its subpackages:
-keep public class com.myapp.customcomponents.**
以下配置保留指定包及其子包中所有公共/受保护类/字段/方法的名称:
The following configuration keeps the names of all public/protected classes/fields/methods in the specified package and its subpackages:
-keep public class com.myapp.customcomponents.** {
public protected *;
}
这篇关于使用proguard时如何保留/排除特定的包路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!