使用EventBus,debug时不报错,release版本报错:its super classes have no public methods with the @Subscribe annota

Posted bbqopdd

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用EventBus,debug时不报错,release版本报错:its super classes have no public methods with the @Subscribe annota相关的知识,希望对你有一定的参考价值。


未添加 EventBus的混淆,所以在Debug版本中不报错
在混淆文件“proguard-rules.pro”中添加:

 1 ### eventbus
 2 -keepattributes *Annotation*
 3 -keepclassmembers class ** {
 4 @org.greenrobot.eventbus.Subscribe <methods>;
 5 }
 6 -keep enum org.greenrobot.eventbus.ThreadMode { *; }
 7 
 8 # Only required if you use AsyncExecutor
 9 -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
10 <init>(java.lang.Throwable);
11 }

 




一般遇到类似debug时没问题,但是release时会报错,那多半就是在配置文件中找问题。

以上是关于使用EventBus,debug时不报错,release版本报错:its super classes have no public methods with the @Subscribe annota的主要内容,如果未能解决你的问题,请参考以下文章