greenrobot / EventBus

Event bus for Android and Java that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.
http://greenrobot.org/eventbus/
Apache License 2.0
24.66k stars 4.66k forks source link

Migrate library from Proguard to R8 will [CRASH] the library #638

Closed Duna closed 4 years ago

Duna commented 4 years ago

Here it is the sample project that proves the EventBus is crashing the app when using newest tool R8. By default R8 is enabled in Android Studio 3.6.1. ProGuard is not used anymore since is deprecated.

Sample Project

How do we solve the issue to keep @Subscribe annotation methods using R8? gradle file:

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
        }

gradle.properties file:

org.gradle.parallel=true

android.useAndroidX=true
android.enableJetifier=true

runProguard=false
Duna commented 4 years ago

625 #616

Duna commented 4 years ago

https://stackoverflow.com/questions/60976867/migrate-eventbus-library-from-proguard-to-r8-will-crash-the-subscriber

Duna commented 4 years ago

I just forget to include the path: proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'