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.

:app:hiltJavaCompile... fails with NoSuchElementException: No value present

See original GitHub issue

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:

* What went wrong:
Execution failed for task ':app:hiltJavaCompileStagingPhyreWEPlayStoreDebug'.
> java.util.NoSuchElementException: No value present

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.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
bcorsocommented, Dec 30, 2021

Yep, that definitely explains it.

The retention determines where the annotation is stored/accessible (SOURCE < BINARY < RUNTIME). For Dagger, the retention needs to be at least BINARY. If you use SOURCE, then anything that depends on your library will no longer see the annotation since the dependency is passed in as a class file. It’s the same reason I mentioned in https://github.com/google/dagger/issues/3133#issuecomment-1002790894, just a different cause.

0reactions
bkolarovcommented, Dec 31, 2021

Okay, that makes sense. I guess it’s all clear now. Thanks for your assistance!

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.util.NoSuchElementException: No value present even ...
firstFirst returns an Optional , that you call get on, if that is an empty Optional - you will get that Exception.
Read more >
java.util.NoSuchElementException: No value present" Data ...
1) Corruption of Data Domain weightage information is usually observed when import of OOTB content (infacmd mrs oie command execution) fails the ...
Read more >
Flow Designer giving "java.util.NoSuchElementException
NoSuchElementException : No value present" error and aslo nt able to open executin details even if they are completed.
Read more >
Jira Software Agile board throws Error No value present when ...
When attempting to access the Issue Detail View on an Agile board, the view does ... NoSuchElementException: No value present at java.util.
Read more >
How to Fix the No Such Element Exception in Java - Rollbar
The NoSuchElementException in Java can be thrown by various accessor methods to indicate that the element being requested does not exist.
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