greenrobot/EventBus · error · EventBusException
Could not find subscriber method in ${subscriberClass}. Mayb
Error message
Could not find subscriber method in ${subscriberClass}. Maybe a missing ProGuard rule? What it means
Thrown by AbstractSubscriberInfo.createSubscriberMethod when resolving a method recorded in the generated subscriber index via subscriberClass.getDeclaredMethod(methodName, eventType) fails with NoSuchMethodException. The index (built at compile time by EventBusAnnotationProcessor) stores method name + event type; at runtime EventBus looks the method up reflectively. If the method no longer exists under that exact name/signature — typically because ProGuard/R8 renamed or removed it — the lookup fails and EventBus hints at missing keep rules.
Source
Thrown at EventBus/src/org/greenrobot/eventbus/meta/AbstractSubscriberInfo.java:75
public boolean shouldCheckSuperclass() {
return shouldCheckSuperclass;
}
protected SubscriberMethod createSubscriberMethod(String methodName, Class<?> eventType) {
return createSubscriberMethod(methodName, eventType, ThreadMode.POSTING, 0, false);
}
protected SubscriberMethod createSubscriberMethod(String methodName, Class<?> eventType, ThreadMode threadMode) {
return createSubscriberMethod(methodName, eventType, threadMode, 0, false);
}
protected SubscriberMethod createSubscriberMethod(String methodName, Class<?> eventType, ThreadMode threadMode,
int priority, boolean sticky) {
try {
Method method = subscriberClass.getDeclaredMethod(methodName, eventType);
return new SubscriberMethod(method, eventType, threadMode, priority, sticky);
} catch (NoSuchMethodException e) {
throw new EventBusException("Could not find subscriber method in " + subscriberClass +
". Maybe a missing ProGuard rule?", e);
}
}
}
View on GitHub (pinned to 0194926b3b)
Solutions
- Add keep rules for annotated methods and the index: -keepattributes *Annotation*,Signature; -keepclassmembers class * { @org.greenrobot.eventbus.Subscribe <methods>; }; -keep class * implements org.greenrobot.eventbus.meta.SubscriberInfoIndex
- Clean and rebuild so the generated index matches current method names
- Verify the eventbusIndex compiler argument matches the actual generated index class name/package
- Reproduce locally by building the minified release variant and checking the mapping.txt for the affected subscriber
Example fix
# before: release build with index, no keep rules
# -> EventBusException: Could not find subscriber method in com.app.Foo. Maybe a missing ProGuard rule?
# after: proguard-rules.pro
-keepattributes *Annotation*,Signature
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep class * implements org.greenrobot.eventbus.meta.SubscriberInfoIndex Defensive patterns
Strategy: validation
Validate before calling
// Debug-mode assertion: every indexed subscriber still exposes its methods
for (Method m : subscriberClass.getDeclaredMethods()) {
if (m.isAnnotationPresent(Subscribe.class)) {
if (!Modifier.isPublic(m.getModifiers())) {
throw new IllegalStateException("@Subscribe method not public: " + m);
}
}
} Try / catch
try {
EventBus.getDefault().register(this);
} catch (EventBusException e) {
if (String.valueOf(e.getMessage()).contains("Maybe a missing ProGuard rule")) {
Log.e(TAG, "Index/method mismatch after obfuscation for " + getClass().getName(), e);
}
throw e;
} Prevention
- Always ship EventBus keep rules when using the subscriber index in minified builds
- Clean-build after method renames so the generated index stays in sync
- Test the minified release variant in CI, not just debug
When it happens
Trigger: Running a minified/obfuscated Android release build with a subscriber index (addIndex / eventbusIndex in gradle apt arguments) but without ProGuard keep rules for @Subscribe methods and the generated index class; stale index from a previous build referencing renamed methods; manually editing/generating the index with wrong method names.
Common situations: Works in debug, crashes in release (R8 renaming onMethod to a); adding the annotation processor and index mid-project; index class itself obfuscated so lookups miss; Gradle apt argument eventbusIndex pointing to an outdated generated class.
Related errors
- Unexpected exception
- It looks like you are using EventBus on Android, make sure t
- Subscriber ${subscriber.getClass()} already registered to ev
- Subscriber ${subscriberClass} and its super classes have no
- Could not send handler message
AI-assisted analysis of greenrobot/EventBus@0194926b3b (2026-08-14).
Data as JSON: /api/errors/c8090e8cde3624f7.
Report an issue: GitHub.