question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ProGuard rules for 3.0.0-beta

See original GitHub issue

This isn’t really an issue as such, but I couldn’t find an answer for this anywhere. The existing 2.x ProGuard rules don’t cut the mustard:

EventBusException: Could not find subscriber method in class com.example.Activity. Maybe a missing ProGuard rule?

Short of downgrading to 2.x, naming all event methods identically, or manually adding each method signature to proguard, is there a known way to get eventbus annotations working with proguard?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
christocracycommented, Nov 6, 2015

I’ve added the proguard config as newly noted in #221, however, I get warning:

Warning: de.greenrobot.event.GeneratedSubscriberIndex: can't find referenced method 'de.greenrobot.event.SubscriberMethod createSubscriberMethod(java.lang.Class,java.lang.String,java.lang.Class,de.greenrobot.event.ThreadMode,int,boolean)' in program class de.greenrobot.event.GeneratedSubscriberIndex

build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'de.greenrobot:eventbus:3.0.0-beta1'
    provided 'de.greenrobot:eventbus-annotation-processor:3.0.0-beta1'
    compile 'com.mcxiaoke.volley:library:1.0.18'
}

proguard-rules.pro


# EventBus 3.0
-keepclassmembers class ** {
    public void onEvent*(**);
}

# EventBus 3.0 annotation
-keepclassmembers class * {
    @de.greenrobot.event.Subscribe <methods>;
}
-keep enum de.greenrobot.event.ThreadMode { *; }

# Only required if you use AsyncExecutor
-keepclassmembers class * extends de.greenrobot.event.util.ThrowableFailureEvent {
    <init>(java.lang.Throwable);
}
0reactions
christocracycommented, Nov 7, 2015

Thanks @talklittle. Turns out I needed an extra proguard rule in my specific case.

-dontskipnonpubliclibraryclassmembers
Read more comments on GitHub >

github_iconTop Results From Across the Web

Proguard rules for Maps v3.0.0 Beta - Stack Overflow
I've been trying to implement the new maps api that google encourages people to start using and I can't get over an error...
Read more >
Crash, marker taps ignored due to incorrect ProGuard ...
The last line was recommended by DexGuard's config debugging at runtime and seems to help. # Google Maps 3.0.0 Beta -keep,includecode class com.google.android....
Read more >
react-native-background-geolocation/android - UNPKG
react-native-background-geolocation/android ; android.iml, 709 B ; app.gradle, 887 B ; build.gradle, 2.99 kB ; proguard-rules.pro, 1.1 kB ...
Read more >
ProGuard Manual: Usage - Guardsquare
Specifies that the entry points specified in the -keep option may be obfuscated, even if they have to be preserved otherwise. That is,...
Read more >
Recent Support Library Revisions - Android Developers
PreferenceDataStore now also correctly restores default values. Revision 28.0.0 Beta 1. (July 2018). This beta release of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found