安卓编译 instances of library classes depending on program classes

问题

执行命令:

/bin/bash -c "external/proguard/bin/proguard.sh -injars 'out/target/common/obj/APPS/TileLauncher_intermediates/classes-desugar.jar' -outjars out/target/common/obj/APPS/TileLauncher_intermediates/classes-proguard.jar -libraryjars out/target/common/obj/APPS/TileLauncher_intermediates/proguard_dictionary -forceprocessing -include build/core/proguard.flags -dontobfuscate -dontoptimize -include out/target/common/obj/APPS/TileLauncher_intermediates/proguard_options"

错误的结果

ProGuard, version 5.1

Reading library jar [ out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar]
Reading library jar [ out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/classes.jar]
Reading library jar [ out/target/common/obj/JAVA_LIBRARIES/core-lambda-stubs_intermediates/classes.jar]
Warning: library class android.hardware.cas.V1_0.ICas extends or implements program class android.hidl.base.V1_0.IBase
Warning: library class android.hardware.cas.V1_0.ICasListener extends or implements program class android.hidl.base.V1_0.IBase

Warning: there were 16 instances of library classes depending on program classes.
	  You must avoid such dependencies, since the program classes will
	  be processed, while the library classes will remain unchanged.
	  (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Error: Please correct the above warnings first.

解决方法

根据关键字找到官网的建议方法。
https://www.guardsquare.com/en/products/proguard/manual/troubleshooting#dependency

If you don’t feel like filtering out the problematic classes, you can try your luck with the -ignorewarnings option, or even the -dontwarn option. Only use these options if you really know what you’re doing though.

只需要在ProGuard 规则文件build/core/proguard.flags末尾加上过滤信息即可
在文件上修改,即可。重新执行。

-dontwarn android.hidl.base.**
-keep class android.hidl.base.**

修改后的结果,没有错误

ProGuard, version 5.1
Reading program jar [out/target/common/obj/APPS/TileLauncher_intermediates/classes-desugar.jar]
  Copying resources from program jar [out/target/common/obj/APPS/TileLauncher_intermediates/classes-desugar.jar]
``
posted @   叉叉敌  阅读(185)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
历史上的今天:
2019-02-17 Failed to start PostgreSQL 11 database server的解决办法
点击右上角即可分享
微信分享提示