我正在使用第三方 .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/