Illegal onEvent method - ProGuard
See original GitHub issueI am receiving this error:
Illegal onEvent method, check for typos
The error appears to be caused by a method name changing in my compile process by ProGuard. Here is a sample of the log I created to test:
methodName=onEvent modifierString= methodName=onEvent$3884d48a modifierString=$3884d48a skipMethodVerificationForClasses={}
The solution is to check for the $ character at the start of the modifierString.
This diff solves the issue:
@@ -91,7 +91,7 @@ class SubscriberMethodFinder {
} else if (modifierString.equals("Async")) {
threadMode = ThreadMode.Async;
} else {
- if (skipMethodVerificationForClasses.containsKey(clazz)) {
+ if (skipMethodVerificationForClasses.containsKey(clazz) || modifierString.startsWith("$")) {
continue;
} else {
throw new EventBusException("Illegal onEvent method, check for typos: " + method);
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
ProGuard Java Optimizer and Obfuscator / Bugs / #585 Is it possible ...
Illegal onEvent method onEventAsync$xxxxx(fx f). and in EventBus. ThreadMode threadMode; if (modifierString.length() == 0) { threadMode = ThreadMode.
Read more >EventBus and Proguard: Could not dispatch event
If you use a non public (package private) onEvent method you will need to update your progaurd config as follows:
Read more >Diff - 7f9be1cbfaafe9f92f3c073a7b48bbfaa12230ba^2 ... - Google Git
IllegalStateException { method public java.lang.String getDiagnosticInfo(); } @@ -15368,6 +15383,14 @@ method public abstract void onEvent(android.media.
Read more >ProGuard Manual: Troubleshooting - Guardsquare
You are trying to process class files compiled for a recent version of Java that your copy of ProGuard doesn't support yet. You...
Read more >[jsoup] Caused by: java.lang.IllegalStateException: Could not ...
해결법은 proguard-ruls.pro 파일을 열고 난독화 예외 코드를 추가해야한다. □proguard-rules.pro 파일. -keep class org.jsoup.**. 모든 클래스의 예외 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had an similar issue and I contacted the creator of ProGuard/DexGuard and he sent me a ‘workaround’ for this.
Just add:
-keepclassmembers,includedescriptorclasses class ** { public void onEvent*(**); }
To your config file to prevent ProGuard/DexGuard’s optimization step to add a suffix to the method name.
Stumbled upon this recently. This should be in the wiki of the project.