EventBus icon indicating copy to clipboard operation
EventBus copied to clipboard

Unable to use org.greenrobot.eventbus inside of separate module

Open sayantanbasu opened this issue 4 years ago • 1 comments

I am trying to access org.greenrobot.eventbus in separate module in my project. But, getting below error. When I'm declaring @Subscribe method in MainActivity activity this is resolved. But, I want to subscribe from the module, not from the main project. Need your help to fix this issue.

org.greenrobot.eventbus.EventBusException: Subscriber class com.sayantan.weekcalender.MainActivity and its super classes have no public methods with the @Subscribe annotation

sayantanbasu avatar Sep 28 '21 08:09 sayantanbasu

it's not about the separate module.

the error means the class doesn't have any method annotated with subscribe (it doesn't receive any event).

you can wrap eventbus.register(this) call inside a try catch block if it's intended behavior on your use case.

andob avatar Sep 28 '21 18:09 andob