I recently tried to migrate the application I'm working on from GCM
to FCM
. While doing so, I found that where I'd previously been using Dagger 2 (2.0.2)
to provide instances of my Retrofit
APIs and other user-data managers inside the service (with no problems), I could no longer do so for the FirebaseMessagingService
.
Whenever I'd try to compile with a subclass of FirebaseMessagingService
listed in my Dagger 2 Component
interface, I'd get an IllegalArgumentException
. After digging through some code, it seems that the exception is thrown when Dagger 2
tries to validate a class name and finds that the first letter isn't uppercase. FirebaseMessagingService
, at least on my end, inherits from a uglified / minified codebase, and its immediate superclass is zzb
(public class FirebaseMessagingService extends com.google.firebase.iid.zzb
).
My best guess is that this is the culprit. If this really is the problem, I'm not sure what to do about this aside from stick to GCM
for now. Anyone have any ideas or similar experience with this?
EDIT: I got the chance to ask one of the Firebase developers about this issue: https://www.reddit.com/r/androiddev/comments/4upj1o/beware_of_the_new_firebase/d5tdbk3 - No resolution. I'm probably just going to avoid direct injection and consolidate to a static API provider.
After half day of struggle, finally moving to Dagger 2.7 fixed the issue.
compile "com.google.dagger:dagger:2.7"
apt "com.google.dagger:dagger-compiler:2.7"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With