随笔 - 123  文章 - 1  评论 - 1  阅读 - 18万 

未混淆的代码为

 

 

 混淆之后:

 

 

 可以看到混淆打包之后注解全都被去掉了!!!

解决方式为添加以下混淆文件

复制代码
# mvp注解框架混淆
-keep @com.example.httplibrary.mvp.inject.InjectPresenter class * {*;}
-keepclasseswithmembers class * {
    @com.example.httplibrary.mvp.inject.InjectPresenter <methods>;
}
-keepclasseswithmembers class * {
    @com.example.httplibrary.mvp.inject.InjectPresenter <fields>;
}
-keepclasseswithmembers class * {
    @com.example.httplibrary.mvp.inject.InjectPresenter <init>(...);
}
# The "Signature" attribute is required to be able to access generic types whencompiling in JDK 5.0 and higher.
-keepattributes Signature
# processing Annotations
-keepattributes *Annotation*
复制代码

加入混淆文件之后,运行正常,加入混淆文件之后代码如下:

posted on   南巷挽清风  阅读(313)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
点击右上角即可分享
微信分享提示