ProGuard 不会混淆对象的方法

ProGuard doesn't performs obfuscation of Object's methods

为了学习 ProGuard 的工作原理,我创建了一个很小的 ​​Android 示例,向其中添加了一些 jar,编写了几行代码,启用了 ProGuard 和等等。

我的 ProGuard 选项是下一个

-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
-optimizationpasses 5
-optimizations !class/unboxing/enum

因此,在将我的 APK 名称反向工程到所有 Object 的方法后,例如 toString()hashCode()equals() 保持不变。除了Object的方法,还有Externalizable个方法的名字

所以你知道为什么会发生这种情况吗?它可以完全修复吗?

ProGuard 无法混淆并非源自您的 类 的方法(其中 "your" 包括您在其中编译的 JAR/AARs)。

您从框架提供的 类 覆盖的任何内容都需要保持完整。否则,框架无法调用这些方法,因为 ProGuard 不会在约 15 亿 Android 设备上混淆固件安装框架 类。