android - 库项目和应用程序项目的 Proguard 文件

标签 android proguard obfuscation android-proguard

我正在使用第三方 .aar 项目,他们在 aar 项目中启用了混淆器。在我的应用程序项目中,我也启用了 Proguard,它给我错误。

那么,我是否需要将他们的(.aar 项目)proguard 规则包含在我的 proguard 配置文件中,还是有任何其他可能性?

我在博客和帖子中读到,最好的方法是在没有混淆器的情况下包含 .aar 项目,然后在 aar 和应用程序项目上作为一个整体运行混淆器。

如果我在应用程序上运行 proguard,它会影响导入库的(已经被 proguarded 的)代码吗?

最佳答案

So, do i need their(.aar project) proguard rules to be included in my proguard config files or is there any other possibility?

引用 the documentation :

You can enable code shrinking on your library by adding a ProGuard configuration file to your library that includes its ProGuard directives. The build tools embed this file within the generated AAR file for the library module. When you add the library to an app module, the library's ProGuard file gets appended to the ProGuard configuration file (proguard.txt) of the app module.

因此,如果库模块的 defaultConfig 中有 consumerProguardFiles 'lib-proguard-rules.txt'(请参阅文档),原则上,这些规则将得到自动应用。

I have read in blogs and posts that the best approach is to include the .aar project without proguard and then run the proguard on aar and application project as a whole.

据我所知,这是典型的计划。因此,AAR 保持不变,ProGuard 应用于应用程序。

If i run proguard on Application will it affect the imported library's(already proguarded) code ?

据我所知,库的代码不应通过 ProGuard 运行。

关于android - 库项目和应用程序项目的 Proguard 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43969160/

相关文章:

android - android源码中的msm是什么意思?

android - 回到主页后恢复 Activity

java混淆器: library doesnt work after optimization

java - 混淆我的 jar 会导致执行时出现空指针

android - 有没有办法检查 React Native 中的互联网连接质量(即 3g vs LTE)?

android - GC 运行过于频繁

android - 带有混淆器的 Ksoap2

android - 禁用 admob 调试消息

c# - 保护我的代码免受逆向工程

java - 使用 Proguard 进行混淆使我的应用程序无法运行