Firebase breaks Dagger
See original GitHub issueWe recently added a class that extends FirebaseMessagingService
to our code base. We use Dagger2 for dependency injection and noticed that our app started to have compilations errors. If we instead just extend Service everything works fine.
When putting verbose stacktrace on we get following stacktrace
Caused by: java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at dagger.internal.codegen.writer.ClassName.peerNamed(ClassName.java:130)
at dagger.internal.codegen.SourceFiles.membersInjectorNameForMembersInjectionBinding(SourceFiles.java:266)
at dagger.internal.codegen.InjectBindingRegistry.registerBinding(InjectBindingRegistry.java:194)
at dagger.internal.codegen.InjectBindingRegistry.getOrFindMembersInjectionBinding(InjectBindingRegistry.java:256)
at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.rollUpMembersInjectionBindings(BindingGraph.java:313)
at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.rollUpMembersInjectionBindings(BindingGraph.java:317)
at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.lookUpBindings(BindingGraph.java:305)
at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.resolve(BindingGraph.java:407)
at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.resolve(BindingGraph.java:410)
at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:168)
at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:105)
The key part is:
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at dagger.internal.codegen.writer.ClassName.peerNamed(ClassName.java:130)
Looking at source we see:
public ClassName peerNamed(String peerClassName) {
checkNotNull(peerClassName);
checkArgument(SourceVersion.isIdentifier(peerClassName));
checkArgument(Ascii.isUpperCase(peerClassName.charAt(0)));
return new ClassName(packageName(), enclosingSimpleNames(), peerClassName);
}
The line in question is:
checkArgument(Ascii.isUpperCase(peerClassName.charAt(0)));
the issue is due to FirebaseMessagingService extending com.google.firebase.iid.zzb which is in fact a class starting with a lower case letter. Not sure how I should proceed. Is this validation necessary?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:8
Top Results From Across the Web
Dagger 2.8 problem with firebase-inappmessaging-display
I have a project that I user dagger 2.8, the project works perfect with firebase-messaging and firebase-core libs, but when I try to...
Read more >Firebase Android SDK Release Notes - Google
BREAKING CHANGE: With this release, the BoM no longer contains the ... Introduce Dagger as a dependency injection framework for some parts of...
Read more >Firebase Dagger | Mass Effect Wiki - Fandom
Firebase Dagger is a multiplayer map in Mass Effect 3. It is located on Ontarom. In single-player, the Galaxy at War mission N7:...
Read more >Using Dagger in Android apps
The Dagger basics page explained how Dagger can help you automate dependency injection in your app. With Dagger, you don't have to write ......
Read more >Mass Effect 3 Multiplayer: Firebase Dagger [N7 Destroyer] - YouTube
Mass Effect 3 Multiplayer: Firebase Dagger [N7 Destroyer] ... SAS Soldier Breaks Down Clean House Mission in Call of Duty: Modern Warfare -...
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
JFYI: for now you can solve this by indirect class where you can inject dependencies required for service that extends
FirebaseInstanceIdService
.Something like this:
Also we were on Dagger 2.02 (shamefully)