-
Notifications
You must be signed in to change notification settings - Fork 6
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
Hilt support #11
Comments
I see the |
Hi, @emartynov ! Right now I can't suggest anything but disabling Hilt's aggregating task
|
Thank you for the suggestion! Let me check first what impact this flag will take on the project. |
@sergei-lapin I set
and it worked! But I'm not sure on the performance implications this may have since the tasks aren't isolating anymore. I'll be running some tests over the next week or so to see if the benefits of napt outweigh that cost. |
I tried to apply the flag in all modules where we have the hilt plugin enabled. However, the project didn't build after. It fails here: I plan to check the classpath for the dagger when napt is enabled. |
@emartynov Have you removed all uses of @sergei-lapin I am now running into a hilt issue where sometimes when I make a change and build I see
But it's inconsistent and clean then build always works |
Ok found the pattern:
Both modules have
As well as all other modules using the hilt and napt plugins. I was able to reproduce this with the sample app in this repo once by creating a base module that has its own activity, hilt module, and simple object with an interface that is bound and injected into the activity. In this app:
Again this has been flakey so sometimes I've had to clean before step 1 or even invalidate caches and restart. It's a lot more consistent in my project which then becomes a developer experience nightmare |
This reverts commit 06d365a. Unfortunately it was causing too many issues with Hilt/Dagger. See sergei-lapin/napt#11
I gave 1.18 a try today on a new Android studio project and found a compilation issue:
Dependencies used:
Tested this without writing any Kotlin code (so no Hilt modules or Databinding layouts are present in the project). Full logs (click to expand)Executing tasks: [:app:assembleDebug] in project /Users/vibinreddy/Documents/workspace/MyApplication23FAILURE: Build failed with an exception.
BUILD FAILED in 510ms |
@vibin that specific issue with task not found should be resolved with v1.19 release. The origin of this error is that you have aggregating task flag set true (default). |
This reverts commit 4213050. Seems issues had been solved, see sergei-lapin/napt#11 (comment)
@sergei-lapin
I got this error message above on my first attempt and discovered this GitHub issue. I tried disabling the aggregating task, but it didn't resolve the issue for me. Then I remembered that in Java classes, we can inject into fields by annotating the setter method. I replaced all field injections that were annotated with a Qualifier so that they now annotate the setter.
to this:
After replacing all the @Inject annotations that had qualifiers, it appears to be working. However, I'd like to ask: are there other reasons to disable enableAggregatingTask? |
Hi! Thanks a lot for the plugin!
This ticket is to make awareness and track progress about using this plugin with the Hilt dependency. If you don't want to have it, please close it.
We use hilt, and I applied the plugin application description to replace
kapt
withnapt
. However, the java compile task fails with the message:I've tried to add manually next dependencies to the app module:
However, it still fails. Drilling down to find the root case and possible solution.
The text was updated successfully, but these errors were encountered: