如何使用Proguard Android混淆包中存在的类?

huangapple go评论71阅读模式
英文:

How to obfuscate classes present in a package by proguard Android?

问题

我想在实施了ProGuard之后混淆一些类文件。

例如,我想要隐藏或混淆特定包中的一些类名和成员,以便在反编译应用程序后不容易理解。

示例:我想混淆位于包com.myapp.serverCall中的类。

我该如何做到这一点?
请帮助我实现这个目标。提前感谢。

英文:

I want to obfuscate some class files after ProGuard implemented.

Like I want to hide or obfuscation some classes name and members in a particular package. So that these will not be understandable after decompiling the application.

Example: I want to obfuscate classes present in package com.myapp.serverCall

How can I do this?
Please help me to achieve this. Thanks in advance.

答案1

得分: 1

你可以使用类似以下选项来保留除了某些包中的类之外的所有类:

-keep class !com.myapp.serverCall.** { *; }

感叹号表示“不包括这些类”,因此只匹配所有其余的类。括号内的星号表示“所有字段和方法”。

英文:

You can preserve all classes except the ones in some packages with an option like

-keep class !com.myapp.serverCall.** { *; }

The exclamation mark means "not these classes", thus only matching all remaining classes. The asterisk between parentheses means "all fields and methods".

huangapple
  • 本文由 发表于 2020年1月6日 17:45:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/59609806.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定