dagger: Dagger-2.17 An exception occurred: java.util.NoSuchElementException
e: [kapt] An exception occurred: java.util.NoSuchElementException
at com.sun.tools.javac.util.List$2.next(List.java:432)
at com.google.common.collect.Iterators.getOnlyElement(Iterators.java:302)
at com.google.common.collect.Iterables.getOnlyElement(Iterables.java:254)
at dagger.android.processor.AndroidMapKeys.mapKeyValue(AndroidMapKeys.java:75)
at dagger.android.processor.AndroidMapKeys.lambda$annotationsAndFrameworkTypes$5(AndroidMapKeys.java:56)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1321)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 54
- Comments: 38
Links to this issue
Commits related to this issue
- Migrate to AndroidX and Google Material libs - Add custom built FlexibleAdapter that supports AndroidX - Update AGP to 3.2.0-rc02, Google Service plugin to 4.1.0, Realm to 5.4.2, ... — committed to teobaranga/T-Tasks by teobaranga 6 years ago
- Use correct ConstrainLayout namespace. Downgrade Dagger version to get around this issue: https://github.com/google/dagger/issues/1245 https://issuetracker.google.com/issues/115738511 — committed to Rightpoint/android-template by deleted user 6 years ago
- Migrate to AndroidX Downgraded Dagger to 2.16 c.f. https://github.com/google/dagger/issues/1245 — committed to ApplETS/Notre-Dame-Android by Sonphil 6 years ago
- Migrate to AndroidX Downgraded Dagger to 2.16 c.f. https://github.com/google/dagger/issues/1245 — committed to ApplETS/Notre-Dame-Android by Sonphil 6 years ago
- Roll back Dagger to 2.16 due to https://github.com/google/dagger/issues/1245 — committed to SamYStudiO/Beaver by SamYStudiO 6 years ago
To confirm, v2.16 works fine. Only happens when switching to v2.17
Jetifier bug raised: https://issuetracker.google.com/issues/115738511
I have same issue with dagger 2.17 and and gradle plugin 3.3.0-alpha05. With 2.16 it works fine.
Seems like this error is persisting into 2.18
I’m also running into this issue, specifically when trying to switch to AndroidX dependencies. I’ve created a minimal repro in tkindy/dagger-androidx-bug (instructions in README).
Any ETA regarding a fix?
It seems to be an (indirect) issue with the Android Gradle Plugin
3.2.0-beta05
. The problem occurs even in an empty project, with a single emptyActivity
, without any Dagger@Component
,@Module
, …It does not occur with Android Gradle Plugin
3.1.4
.build.gradle:
It can also be observed that, with
3.2.0-beta05
, the dependency resolution is strange. I can’t tell where the 2.16 comes from.With
3.1.4
, it looks more as expected:Everything works like charm again. I had issues with other xml support widgets that were causing the build to fail before it reaches Dagger. When those issues are fixed, the jetifier worked well and the project compiled. Thanks for the help @tasomaniac
I mentioned this line of the Jetifier sources that I found which prevents the 2.17 upgrade. I also briefly tried to change that config file inside the jetifier jar. It had the desired effect (working 2.17 dependencies) but this resulted in a different error. Unfortunately, I’m traveling right now and don’t have more details at hand.
Edit: In fact, patching the config files of jetifier-core-1.0.0-alpha10.jar worked fine to get dagger 2.17 working. Any additional issues I ran into were simply those explained in the 2.17 changelog.