Search code examples
androidproguardandroid-proguardgreenrobot-eventbus

Proguard green robot event bus


I'm using Event bus on my app. following the docs I've added

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

to my <project>/app/proguard-rules.pro

But when compile my app alsways get the error

ava.lang.RuntimeException: Unable to start activity ComponentInfo{com.rkmax.myapp.MyActivity}:  org.greenrobot.eventbus.e: Subscriber class com.rkmax.myapp.MyActivity and its super classes have no public methods with the @Subscribe annotation

my app is workin fine on debug release. maybe it's something I'm missing


Solution

  • All my Subscribe-annotated methods was defined like void methodName(...) I found I must explicit add public in order to work correctly on releases builds