Android:危险 and/or 非混淆 APK 的缺点?

Android: dangers and/or downsides of non-obfuscated APK?

因此,我们都使用 ProGuard 混淆了我们发布的 APK,以便更难对我们宝贵的代码进行逆向工程。但我开始怀疑是否真的有必要为一个开源应用程序?

让我们以 Telegram 为例 - 他们的 source code is readily available at GitHub,因此在这种情况下逆向工程保护无关紧要。

我的问题是:除了更难的逆向工程之外,混淆还有其他好处吗?

编辑: 这个问题具体是关于混淆,而不是一般的 ProGuard。

如果您想为自己的代码提供一定程度的隐私,那么混淆非常重要。

想象一下,你想出了一个非常好的库,它被许多渴望赚钱的潜在开发者所垂涎。他们可以轻松访问您的源代码(通过 github 或 apk 反编译),将其撕下并在他们自己的应用程序中使用,您将不会因此获得任何信用。

输入:软件许可证 通过指定软件许可证,您可以告知任何潜在的开发人员对您自己的知识分子来说该做什么和不该做什么 属性。
如果您将您的代码保密,那么有人就很难从中合法获利,但请记住,有些人不会尊重这一点,并会尝试复制该代码。这就是混淆的用武之地。
通过混淆您的代码,其他人很难perceive/read,从而获得一定程度的保护。

Android 中的标准混淆是通过使用 Proguard(及其专业和更好的产品,如 DexGuard)实现的。

请记住,Proguard 不仅是混淆工具,而且还用于:

Code Shrinking(减小代码的大小并转储您的应用程序不需要的 类)

In the shrinking step, ProGuard starts from these seeds and recursively determines which classes and class members are used. All other classes and class members are discarded.

代码优化

In the optimization step, ProGuard further optimizes the code. Among other optimizations, classes and methods that are not entry points can be made private, static, or final, unused parameters can be removed, and some methods may be inlined.

混淆

In the obfuscation step, ProGuard renames classes and class members that are not entry points. In this entire process, keeping the entry points ensures that they can still be accessed by their original names.

The preverification step is the only step that doesn't have to know the entry points.

@非常重要的注意事项混淆您的代码并不能完全防止盗窃或复制。

使用适当的工具和一点耐心,一个非常有经验的开发人员最终可能会破解混淆(这只取决于他们对代码的需求)

@结论
无论是小型项目还是复杂项目,都应该始终使用 ProGuard。事实上,在构建期间删除未使用的代码可以减少对 apk 的需求 space 并提高性能(我有 ProGuarded 应用程序,由于缩小过程,它们的大小最多减少了 25%)。 即使您的应用程序代码可能可以通过 Github 或其他存储库获得,您也应该保持 ProGuard 脚本整洁干净(即使在压缩过程中只删除了少数 类)。

但是回答你的主要问题:如果代码至少简单优化并向所有人开放,你可以跳过混淆