Hilt: More meaningful error messages
See original GitHub issueFirst of all, Hilt looks like a really promising project, keep up the good work!
One feature I would like to see is more meaningful error messages at run time and compile time. For instance, one error I always seem to get is:
Caused by: java.lang.ClassCastException: com.mypackage.DaggerMainApplication_HiltComponents_ApplicationC$ActivityRetainedCImpl$ActivityCImpl cannot be cast to com.com.mypackage.MyActivity_GeneratedInjector
This runtime exception basically means that there is an error in the dependency graph meaning something can’t be injected, but it would be nice to know what exactly.
Even better, if this problem could be caught and displayed at compile time, then fantastic 😃
kind regards, goldy1992
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:18 (5 by maintainers)
Top Results From Across the Web
Kotlin + hilt error. [Hilt] and java.lang.reflect ... - Stack Overflow
Recently I started learning Kotlin and Hilt for my project. I watched some tutorials and afterwhile tried to write my own code.
Read more >Debugging with Hilt / Dagger / Dependency Injection - Reddit
I've tried "Run with --info or --debug option to get more log output. ... You might actually get a useful error message that...
Read more >Dependency injection with Hilt | Android Developers
More. Platform Android Studio Google Play Jetpack Kotlin Games. Language ... Transfer assets · Send and receive messages · Handle data layer events ......
Read more >Migrating to Hilt - Dagger
You can find out when Hilt injects classes for each Android class here. These hopefully should be similar to where your code currently...
Read more >MAD Skills series: Hilt under the hood | by Brad Corso - Medium
As this blog post is about Hilt, we won't go into further details about the Dagger generated code. However, if you're interested, ...
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
@Chang-Eric, is it expected to occur in below scenario?
:ui-component module - ‘com.android.library’ :profile module - ‘com.android.library’
:app module - ‘com.android.application’
In the above project, I have my Application class in :ui-component module.
And my Activity is in :profile module.
But when I run this app, I get below exception at runtime.
What could go wrong here? And why it’s a runtime error instead of compile time?
i just got an error and all it said was [Hilt] lol