Error needs context: "Dagger does not support injection into private fields"
See original GitHub issueThe 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:
- Created 7 years ago
- Comments:9
Top 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 >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
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.
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?