Get "has no methods called onEvent" when onEvent is present and only when downloaded from Google Play
See original GitHub issueHello. I’ve been slowly tracking down a bug for the past week or longer and I’m hoping you can help me with it. I started using EventBus in my latest app and I love it. So simple. My problems occur when I download the app from Google Play. I get a crash with the following error:
java.lang.ExceptionInInitializerError at com.jbonesstudios.holdemcompare.activities.MainActivity.<init>(Unknown Source) at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1208) at android.app.Instrumentation.newActivity(Instrumentation.java:1067) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2299) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) at android.app.ActivityThread.access$900(ActivityThread.java:170) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5635) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) at dalvik.system.NativeStart.main(Native Method) Caused by: a.a.a.h: Subscriber class com.jbonesstudios.holdemcompare.c.b has no methods called onEvent at a.a.a.o.a(Unknown Source) at a.a.a.c.a(Unknown Source) at a.a.a.c.a(Unknown Source) at com.jbonesstudios.holdemcompare.c.b.<init>(Unknown Source) at com.jbonesstudios.holdemcompare.c.b.<clinit>(Unknown Source) … 16 more
This doesn’t make sense to me because I do have an onEvent method in the file. Here are the pertinent code bits:
import de.greenrobot.event.EventBus;
public class MainActivity extends AppCompatActivity { private EventBus mEventBus = EventBus.getDefault();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public void onResume() {
super.onResume();
mEventBus.register(this); //crashes when downloaded from Google Play
}
@Override
public void onPause() {
mEventBus.unregister(this);
super.onPause();
}
public void onEventMainThread(StopSimulationEvent event) {
// code
}
}
I’m sure I must be doing something wrong because I haven’t found anyone else having the same problem. What am I missing? Can you help me?
-Joey
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top GitHub Comments
http://greenrobot.org/eventbus/documentation/proguard/
@bhavikgandhi007 was just about to post the new link, then I noticed @gregparsons has already posted it.