当前位置: 代码迷 >> 综合 >> Android EventBus 报错 xxx and its super classes have no public methods with the @Subscribe annotation
  详细解决方案

Android EventBus 报错 xxx and its super classes have no public methods with the @Subscribe annotation

热度:54   发布时间:2023-12-22 06:29:32.0

出现此错误的原因之一:代码混淆后,无法识别 @Subscribe annotation。

解决方法:proguard config file文件添加如下配置:

-keepattributes *Annotation*
-keepclassmembers class ** {@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

 

  相关解决方案