Home » Android » java – EventBus – @Subscribe annotated method is never used

java – EventBus – @Subscribe annotated method is never used

Posted by: admin June 15, 2020 Leave a comment

Questions:

When using the greenrobot EventBus library, all @Subscribe-annotated methods are displayed in light grey with a warning Method onMyEvent() is never used in Android Studio.

Is there a way to automatically suppress this warning (as the method is not directly called from code, but in response to an event on the event bus)?

How to&Answers:

You can turn it off by pointing to left of the light greyed code.

Then after bulb icon appear, click and select ‘Suppress method annotated by org.greenrobot…’


UPDATE

Found new working plugin for EventBus 3 IntelliJ at
eventbus3-intellij-plugin. This is a working fork of Shinnosuke Kugimiya eventbus3-intellij-plugin.

Working with Android Studio 2.1.3.