greenrobot / EventBus

Event bus for Android and Java that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.
http://greenrobot.org/eventbus/
Apache License 2.0
24.67k stars 4.66k forks source link

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

Open sayantanbasu opened 2 years ago

sayantanbasu commented 2 years ago

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

andob commented 2 years ago

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.