如何保持/排除特定包路径使用ProGuard的时候?路径、时候、ProGuard

2023-09-12 22:34:17 作者:可耐到爆

我要排除来自ProGuard的一些文件路径。示例 com.myapp.customcomponents

我怎样才能做到这一点?我讨厌被放置-keep标志为每一个自定义组件文件,我有这个目录中。

我曾尝试以下,但它不工作:

  -keep公共类com.myapp.customcomponents。*
 

解决方案

您不要用什么方式这是行不通的规定。你的配置使所有的公共类的名称指定包中:

  -keep公共类com.myapp.customcomponents。*
 
word界面大体功能是哪些

下面的配置保持所有公共类指定的包及其子包的名称:

  -keep公共类com.myapp.customcomponents。**
 

下面的配置保存所有的公共/保护类/场/指定的包的方法及其子包的名称:

  -keep公共类com.myapp.customcomponents。** {
  公众保护*;
}
 

I want to exclude some file paths from ProGuard. Example com.myapp.customcomponents

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 *;
}