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.

Open ContributesAndroidInjector for other classes

See original GitHub issue

I’m using Conductor and created a DispatchingAndroidInjector for Controllers (like fragments from a dagger perspective). That works great.

However I want to make use of the ContributesAndroidInjector annotation because I don’t want to go through all the boilerplate of creating subscomponents manually. However dagger fails with an exception that only framework classes are allowed. What is the reason for that? Can it be done anyways?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:12
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

14reactions
ronshapirocommented, Sep 14, 2018

I’m reopening this - given the recent androidx developments and lots of new, smaller libraries, I think it’s worth reconsidering opening up support.

@AndroidInjectionKey also simplifies this. And if people want to use class literals, they can use their own map key as well.

5reactions
PaulWoitaschekcommented, Jul 9, 2017

Controllers are really similar to fragments and it’s a real bummer creating so many subcomponents.

Isn’t it possible to create some plugin structure where you can define your map @MapKey and base class?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dagger 2 with ContributesAndroidInjector - Is it easy? - Medium
From docs — Android Injector is an interface that enclose an abstract class Builder<T> and a Factory interface, the main purpose of this ......
Read more >
ContributesAndroidInjector same fragment with different ...
I've been trying to find a way to provide dependencies depending where a fragment is navigated from. I have the following in a...
Read more >
Dagger 2 Annotations: @Binds & @ContributesAndroidInjector
In this article we will briefly look at two annotations : @Binds and @ContributesAndroidInjector . It is not mandatory to have read the ......
Read more >
Injecting Activities with Dagger2 and ... - YouTube
In this video I show you how to use the @ ContributesAndroidInjector to "mark" an activity as a potential client for dagger dependency ......
Read more >
Dagger by Tutorials, Chapter 16: Dagger & Android | Kodeco ...
Which utility classes Android Dagger provides. How to use @ContributesAndroidInjector . Why Android is different for Dagger. In the previous chapters ...
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