androidfirebasedaggerrxbluetooth

Updating Firebase causes RxBLE crash


Okay, so I'm having some very odd behaviour that doesn't make much sense in my app.

My app uses BLE and I have a static class which I initialize on app launch, this typically works with no issue.

Today I made a single change in my app which was to update this:

    implementation 'com.google.firebase:firebase-core:17.2.1'
    implementation 'com.google.firebase:firebase-messaging:20.0.0'

To this:

    implementation 'com.google.firebase:firebase-core:17.2.2'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'

And after making this minor version update to firebase core, my app now immediately crashes on launch with the following error:

2020-02-13 09:44:57.530 20760-20760/my.package.name E/AndroidRuntime: FATAL EXCEPTION: main
    Process: my.package.name, PID: 20760
    java.lang.NoSuchMethodError: No static method injectMembers(Ldagger/MembersInjector;Ljava/lang/Object;)Ljava/lang/Object; in class Ldagger/internal/MembersInjectors; or its super classes (declaration of 'dagger.internal.MembersInjectors' appears in /data/app/my.package.name-Nbmle9woVCiX-2v0teYwZw==/base.apk!classes3.dex)
        at com.polidea.rxandroidble.RxBleAdapterStateObservable_Factory.get(RxBleAdapterStateObservable_Factory.java:28)
        at com.polidea.rxandroidble.RxBleAdapterStateObservable_Factory.get(RxBleAdapterStateObservable_Factory.java:10)
        at com.polidea.rxandroidble.RxBleClientImpl_Factory.get(RxBleClientImpl_Factory.java:104)
        at com.polidea.rxandroidble.RxBleClientImpl_Factory.get(RxBleClientImpl_Factory.java:23)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.polidea.rxandroidble.DaggerClientComponent.rxBleClient(DaggerClientComponent.java:419)
        at com.polidea.rxandroidble.RxBleClient.create(RxBleClient.java:54)
        at my.package.name.Comm.RxBLEComm.<init>(RxBLEComm.java:109)  // These are the only
        at my.package.name.Comm.RxBLEComm.init(RxBLEComm.java:118)    // lines in my code which
        at my.package.name.RootApp.onCreate(RootApp.kt:63)            // are totally unrealted to firebase
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1155)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5928)
        at android.app.ActivityThread.access$1100(ActivityThread.java:200)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6735)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2020-02-13 09:44:57.586 2989-3111/? E/NetworkController.MobileSignalController(2): showVoteIcon=false

Note: My app does not use dagger at all, though the RxBLE library might...

If I revert the firebase update the app builds and runs with no issue, so for now I'll just stick to using firebase-messaging:20.0.0 and firebase-core:17.2.1, but does anyone have any clue why this might be happening?

This is the only line of code required to make the crash happen:

RxBleClient.create(applicationContext)

Here is a test repo that you can reproduce the crash in: https://github.com/Doophie/TestAppCrash

Note that there are 2 commits, in the first commit the app has updated firebase and crashes, the second commit it does not crash and uses the older firebase version.


Solution

  • So the issue was the version of the rxandroidble library was incompatible with the new firebase messaging.

    When I updated from

    implementation 'com.polidea.rxandroidble:rxandroidble:1.4.3'

    to

    implementation 'com.polidea.rxandroidble:rxandroidble:1.7.1'

    the crash stopped.