-
Notifications
You must be signed in to change notification settings - Fork 3.1k
No injectable members on com.actionbarsherlock.app.SherlockFragmentActivity #74
Comments
Are you instantiating one of these directly, or are you subclassing? And this almost looks like you are using Dagger to construct an activity, which flies in the face of Android... |
Subclassing. Sorry - I cut off the error message, so perhaps that will give a better clue. Here's the full message:
MyActivity looks like: public class MyActivity extends SherlockFragmentActivity {
@Inject MyStore store;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((MyApplication) getApplication()).inject(this);
// more work here
}
} Also, MyActivity is declared as an entryPoint. |
I just pulled and merged the latest upstream master and got a different exception: Caused by: java.lang.IllegalStateException: Errors creating object graph: Then I added an explicit constructor in SherlockFragmentActivity.
This explicit constructor fixes these errors. I'd like to understand better why this would be required, though. I assume this isn't normal ABS/Dagger integration. |
Generally, something must have an @Inject in it somewhere to function. However, it does not need that for super classes. What you have looks pretty good. @swankjesse, any thoughts? And just a sanity check, you're not @injecting an activity anywhere, are you? |
If you got the no at inject provider could be found that probably means you You need to add an @Inject constructor or field(s). Regards, On Oct 25, 2012, at 18:32, Patrick Forhan notifications@github.com wrote: Generally, something must have an @Inject https://github.com/Inject in What you have ooks pretty good. @swankjesse https://github.com/swankjesse, And just a sanity check, you're not @injecting an activity anywhere, are — |
Sorry. Missed it. Reading on my phone. Upon further thought, I don't think we process annotations on superclasses Regards, On Oct 25, 2012, at 18:51, Patrick Forhan notifications@github.com wrote: @cgruber https://github.com/cgruber FYI, in the 3rd comment, he shows an — |
@cgruber, did you ever look at this again? The way I understand it, this wasn't about annotations on super classes, it was a confusing message Dagger was giving out about a library superclass -- We do this with no issue (even the extending of SherlockFragmentActivity), but I don't know if there is some magic combination that @luisdelarosa is hitting upon. |
On 29 Oct 2012, at 11:16, Patrick Forhan wrote:
Hadn't gotten to it. I'll dig into it today and/or tomorrow. c. |
Found it & fixed it. #84 |
Not sure whether or not to create a new issue here, but this fix works fine when using the reflection strategy. Using 0.9 artifcacts, if I switch to the code generation strategy (by adding the dagger-compiler plugin dependency) I get the following error at runtime:
I noticed that in MyActivity$InjectAdapter, the supertype instance field is set like this in the attach method:
The two argument Linker.requestBinding method calls the three argument Linker.requestBinding method with mustBeInjectable = true. Could this be the source of the error? |
Really fixed this with #102. We didn't catch this in our own apps 'cause we accidentally disabled dagger-compiler when that code was split from the main module. We're running it now. That explains why I didn't see it. Thanks! |
On 11 Nov 2012, at 18:31, Jesse Wilson wrote:
Good test on #102, btw, Jesse. |
I'm trying to use Dagger with ActionBarSherlock 4.2.0.
I'm getting this error:
This worked fine with a regular FragmentActivity. How can I fix this?
Thanks!
The text was updated successfully, but these errors were encountered: