-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:app:hiltJavaCompile... fails with NoSuchElementException: No value present #3133
Comments
@bkolarov do you have a full stack trace? (If you're building with Gradle you main need to pass |
@bcorso sure. Here it is:
|
Based on the stacktrace, it looks like the issue is that we can't find the Unfortunately, the error message doesn't tell you exactly which custom map key it failed to find (we're working on improving the error messages more generally); however, assuming you don't have too many custom map keys in your project you can likely narrow it down pretty easily. The fix is to add the custom map key onto the classpath so that the processor has access to it while processing your component. Typically, this means either adding it as a direct dependency or making the Module's dependency on it |
This CL adds a repro for issue #3133, where Dagger throws an unexpected exception when a custom map key is no longer on the classpath. A follow-up CL will fix the issue to return a better error message. RELNOTES=N/A PiperOrigin-RevId: 418854284
Thanks for the reply @bcorso. However all custom |
Update: I think I figured it out. It appears that I forgot to remove the usage of the dagger annotation processor and use only hilt's. Once I removed it, I got a different kind of error with actual details (this is expected, since I'm migrating). |
This CL adds a repro for issue #3133, where Dagger throws an unexpected exception when a custom map key is no longer on the classpath. A follow-up CL will fix the issue to return a better error message. RELNOTES=N/A PiperOrigin-RevId: 418854284
This CL adds a repro for issue #3133, where Dagger throws an unexpected exception when a custom map key is no longer on the classpath. A follow-up CL will fix the issue to return a better error message. RELNOTES=N/A PiperOrigin-RevId: 418966521
…lasspath. See #3133 (comment) Fixes #3133 RELNOTES=Fixes #3133: Adds a better error message when custom map key is not on classpath. PiperOrigin-RevId: 418867510
…lasspath. See #3133 (comment) Fixes #3133 RELNOTES=Fixes #3133: Adds a better error message when custom map key is not on classpath. PiperOrigin-RevId: 418972001
@bkolarov I'm glad you fixed your issue! However, I'm still not really sure what's happening there since the If you have the time and can still reproduce the original error, I'd still be interested in seeing what was going wrong there. I submitted a change that should now include more information in the error message. Those changes aren't in an official release yet, but you can try it out using the |
@bcorso So after I fixed all the issues during migration and I tried to reproduce the problem. It turns out it was something different: I started getting this error as soon as I annotated one of my custom map keys with |
Yep, that definitely explains it. The retention determines where the annotation is stored/accessible ( |
Okay, that makes sense. I guess it's all clear now. Thanks for your assistance! |
AGP: 7.0.4
Hilt version: 2.40.5
I'm migrating a project from Dagger to Hilt. I started getting this error during build:
The message is pretty vague and I have no idea where I messed up. The project is somewhat big, so it's hard to check everything manually. I noticed that the Hilt_MyApplication is not being generated, however I'm not sure at what phase this should happen.
Having more details when this occurs would be helpful. Meanwhile any suggestions on how to debug it will be appreciated.
The text was updated successfully, but these errors were encountered: