如何保持/排除特定包路径使用ProGuard的时候? [英] How to keep/exclude a particular package path when using proguard?

查看:563
本文介绍了如何保持/排除特定包路径使用ProGuard的时候?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

解决方案

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

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

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

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

这篇关于如何保持/排除特定包路径使用ProGuard的时候?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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