How to keep/exclude a particular package path when using proguard?

 ̄綄美尐妖づ 提交于 2020-01-18 03:55:28

问题


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.*

回答1:


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



回答2:


Add the following line at the bottom of your ProGuard configuration:

-keep class com.facebook.** { *; }

Replace package name accordingly, here the package com.facebook will be excluded from ProGuard.



来源:https://stackoverflow.com/questions/4830474/how-to-keep-exclude-a-particular-package-path-when-using-proguard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!