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.

Error needs context: "Dagger does not support injection into private fields"

See original GitHub issue

The error (Dagger does not support injection into private fields) will appear when you attempt to inject a value into a private field. The error condition itself is OK and understandable but the error message does not include any context, making it can be difficult to track down exactly which field is (fields are) affected. In my particular case one erroneous field that doesn’t even appear to be private is causing 9 such error messages in a row, making it extra difficult to figure out what the hell is going on. (This ticket isn’t reporting that as an issue, only the error message itself).

I am using Dagger 2.8.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
gk5885commented, Jan 10, 2017

Yeah, this rings a bell. I think people have had this sort of trouble with kapt in the past. It’s probably worth filing a bug with them about it. Closing this for now as I don’t think there’s much we can do aside from calling the right processing apis with the right values.

1reaction
ronshapirocommented, Jan 10, 2017

I’m not familiar with actually using Kotlin, but I know kapt still has some rough edges. I wonder if this is bad coordination with javac somehow?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kotlin Error: Dagger does not support injection into private fields
Its a shortcoming of Dagger in general- it can't access private fields. Doing so would require reflection and would be impossible to do...
Read more >
Getting "Dagger does not support injection into private fields ...
Getting "Dagger does not support injection into private fields" when Dagger is not on the classpath ; Project, IntelliJ IDEA ; Priority, Normal...
Read more >
Using Dagger 2 for dependency injection in Android - Tutorial
Dagger 2 uses generated code to access the fields and not reflection. Therefore it is not allowed to use private fields for field...
Read more >
Dependency Injection in Kotlin using Dagger2
Dagger doesn't support Injection in private fields and the final field. Field injection is mostly frequently used dependency injection technique.
Read more >
Kotlin Error: Dagger does not support injection into private fields
Android : Kotlin Error : Dagger does not support injection into private fields [ Beautify Your Computer ...
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