2

On some of the devices I'm getting this error when trying to send an event with the Otto event bus:

Exception java.lang.RuntimeException: Could not dispatch event: class xxx.xxx.MyEvent to handler [EventHandler public void xxx.xxx.onEventReceived(xxx.xxx.MyEvent)]: java.lang.NoSuchMethodException: start [class android.app.Activity]

What is start [class android.app.Activity] and why am I getting this exception?

I've tried to reproduce with some other devices and I can not. Seemingly this only happens on some devices, randomly. It might be related to Proguard, since I'm getting this from the obfuscated app. It's a multidex app if that's of any help

Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158
  • Might be a lower API version on the device? – Murat Karagöz Jun 09 '16 at 14:31
  • When dispatching to `onEventReceived(MyEvent)` your method tried to call a `start(Activity)` method but failed because there is no such method. Might be proguard. Should there be such a method? `start [class android.app.Activity]` = `start(Activity param)`, I guess it's in the same class as your event handler. See somewhat self-explaining stacktrace in http://stackoverflow.com/q/11695835 – zapl Jun 09 '16 at 14:47
  • @Murat K, no it works on the same API level for me – Alexander Kulyakhtin Jun 09 '16 at 14:51
  • @zapl No, I do not have any such start() method, neither Activity has as I can see from the Activity.java AOSP file. Only my method is annotated by Subscribe annotation but somehow Otto complains about start() – Alexander Kulyakhtin Jun 09 '16 at 14:54
  • Sorry, I was mistaken and edited my comment, it's not a method of activity, it's a method that has an activity as it's only parameter. Do you get a stacktrace with a `caused by java.lang.NoSuchMethodException` section? It should contain the place that tries to call that method as it's first entry. – zapl Jun 09 '16 at 15:56
  • Look here https://github.com/square/otto/issues/37, probably you are having the same issue – Juan Cruz Soler Jun 09 '16 at 16:03

0 Answers0