keep说明
-keep:类及所有成员变量方法全部不混淆
-keepclassmembers:如果类不混淆,则成员变量方法不混淆
-keepclasseswithmembers:对有指定成员的类不混淆
-keepnames:在未被当做无用类删除的情况下不混淆
-keepxxxnames:在未被当做无用类删除的情况下对应相应的keepxxx类模板
[@annotationtype] [[!]public|final|abstract|@ ...] [!]interface|class|enum classname
[extends|implements [@annotationtype] classname]
[{
[@annotationtype] [[!]public|private|protected|static|volatile|transient ...] <fields> |
(fieldtype fieldname);
[@annotationtype] [[!]public|private|protected|static|synchronized|native|abstract|strictfp ...] <methods> |
<init>(argumenttype,...) |
classname(argumenttype,...) |
(returntype methodname(argumenttype,...));
[@annotationtype] [[!]public|private|protected|static ... ] *;
...
}]
- 说明
- class可以匹配class和interface
- 可以使用?(单字)、*(类名的任意部分,不包括包名)、**(类名的任意部分,包括包名)
- 多个类名可以使用逗号隔开
- extends和implements是一样的
<init>
表示构造函数,<fields>
表示成员变量,<methods>
表示成员方法- 在返回值的匹配上:
- %代表基本类型
- ?代表非基本类型的类名中的单字
- * 代表非基本类型的类名中不包含包名的类名片段
- ** 代表非基本类型的类名中包含包名的类名片段,不包括数组
- *** 任何类型,包括基本类型
- … 任何类型、任何数量的参数