android混淆规则怎么写?
How to write android proguard rules?
我想学习如何编写 android proguard 规则以混淆代码并使对应用进行逆向工程变得更加困难。
我搜索了很多简单的解释,但似乎找不到有用的东西,我在这里阅读了 proguard 的文档 (https://www.guardsquare.com/en/products/proguard/manual/usage), But I found it very confusing & I didn't understand anything, Also read this doc. (https://developer.android.com/studio/build/shrink-code#obfuscate),但除了介绍之外别无其他。
也在 Youtube 上搜索了很多,但我没有找到任何有用的东西,以及在互联网上搜索文章。
我想要一个简单的解释,解释应该在 proguard 规则文件中写入什么,什么是 Keep & dontwarn .. 等等,以及如何在混淆后测试应用程序以及如何确保没有错误,因为在 Play 商店发布后的混淆。
提前致谢。
虽然 progaurd introduction & progaurd usage documentation 提供了有关它的简要细节,但以下是一些有助于您理解的示例:
基本上 Progaurd 默认情况下会收缩和混淆您应用中的所有代码,但有时我们可能不需要它,因此我们需要描述必要的 -keep 选项。
要在任何图书馆不提供规则或您不知道要避免混淆哪些 class 时提出规则?
阅读构建输出和logcat:
生成警告会告诉您要添加哪些 -dontwarn 规则
ClassNotFoundException、MethodNotFoundException 和 FieldNotFoundException 会告诉您要添加哪些 -keep 规则
要在整个模型上添加 @Keep 注释 class 或在所有模型上添加通配符规则:
-keep class com.somaapp.abc.model.** { *; }
ProGuard 将默认删除程序执行不需要的许多代码属性和隐藏元数据。其中一些实际上对开发人员很有用——例如,您可能希望保留源文件名和行号以进行堆栈跟踪以简化调试:
-keepattributes SourceFile, LineNumberTable
您可以查看 attributes list in the ProGuard manual。
Usage section of the progaurd manual describes the necessary -keep options and the Examples section 提供了大量示例。
我想学习如何编写 android proguard 规则以混淆代码并使对应用进行逆向工程变得更加困难。
我搜索了很多简单的解释,但似乎找不到有用的东西,我在这里阅读了 proguard 的文档 (https://www.guardsquare.com/en/products/proguard/manual/usage), But I found it very confusing & I didn't understand anything, Also read this doc. (https://developer.android.com/studio/build/shrink-code#obfuscate),但除了介绍之外别无其他。
也在 Youtube 上搜索了很多,但我没有找到任何有用的东西,以及在互联网上搜索文章。
我想要一个简单的解释,解释应该在 proguard 规则文件中写入什么,什么是 Keep & dontwarn .. 等等,以及如何在混淆后测试应用程序以及如何确保没有错误,因为在 Play 商店发布后的混淆。 提前致谢。
虽然 progaurd introduction & progaurd usage documentation 提供了有关它的简要细节,但以下是一些有助于您理解的示例:
基本上 Progaurd 默认情况下会收缩和混淆您应用中的所有代码,但有时我们可能不需要它,因此我们需要描述必要的 -keep 选项。
要在任何图书馆不提供规则或您不知道要避免混淆哪些 class 时提出规则?
阅读构建输出和logcat:
生成警告会告诉您要添加哪些 -dontwarn 规则 ClassNotFoundException、MethodNotFoundException 和 FieldNotFoundException 会告诉您要添加哪些 -keep 规则
要在整个模型上添加 @Keep 注释 class 或在所有模型上添加通配符规则:
-keep class com.somaapp.abc.model.** { *; }
ProGuard 将默认删除程序执行不需要的许多代码属性和隐藏元数据。其中一些实际上对开发人员很有用——例如,您可能希望保留源文件名和行号以进行堆栈跟踪以简化调试:
-keepattributes SourceFile, LineNumberTable
您可以查看 attributes list in the ProGuard manual。
Usage section of the progaurd manual describes the necessary -keep options and the Examples section 提供了大量示例。