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.

Incremental build failures with 2.25.2 (new Kotlin qualifier annotations)

See original GitHub issue

Seeing this frequently with incremental builds since updating to 2.25.2. Works fine on a clean build.

/path/to/AppComponent.java:78: error: [Dagger/MissingBinding] android.net.Uri cannot be provided without an @Provides-annotated method.
public interface AppComponent extends AndroidInjector<App>{
       ^
      android.net.Uri is injected at
          ynab.app.web.WebViewActivity.serverUrl

Here’s the relevant parts of the component (Java):

public interface AppComponent extends AndroidInjector<App>{

    // lots of other stuff

    @Component.Builder
    interface Builder {

        // lots of other stuff

        @BindsInstance Builder serverUrl(@Named("ServerUrl") Uri serverUrl);

    }
}

The error only happens since updating Dagger to 2.25.2 and changing the injection site to benefit from the new Kotlin support.

BEFORE - always worked fine

@Inject @field:Named("ServerUrl") internal lateinit var serverUrl: Uri

AFTER updating to 2.25.2 - regular incremental build failures

@Inject @Named("ServerUrl") internal lateinit var serverUrl: Uri

If I have misunderstood what’s supposed to be possible with 646e0336cdbe454baa5fe73c0af11f211a92deeb then I look forward to being educated. 😃

Dagger 2.25.2 Kotlin 1.3.50 Android Gradle Plugin 3.5.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
danysantiagocommented, Oct 30, 2019

Thanks for reporting this! We are aware of some cases where Dagger is still unable to find the qualifier annotation, meaning you have to fallback to @field:Named.

I was able to reproduce the issue in a small project with two gradle modules. App and Lib. Where Lib has the Kotlin class being member injected and App is where Dagger is setup with kapt. The issue is that Dagger is failing to find the synthetic method where property annotations are placed when the class being inspected is not from source, i.e. its already compiled.

We are still working on a fix but at the same time I filled a bug towards kapt with regards to the stub inconsistency: https://youtrack.jetbrains.com/issue/KT-34684

1reaction
gildorcommented, Nov 7, 2019

@GuilhE This issue reproducible and for @Named and for @Qualifier, so no difference.

as an improvement

It’s improvement only if you do not use this dependency between modules, sometimes you just cannot access annotation without creating a separate module for it which is overkill in many cases

Read more comments on GitHub >

github_iconTop Results From Across the Web

Any pitfalls with Dagger setup implemented using Kotlin in a ...
Generally I have found that usage in a mixed codebase is not too problematic. Some problems that previously existed: Qualifier annotations on ...
Read more >
A New Approach to Incremental Compilation in Kotlin
In Kotlin 1.7.0, we've reworked incremental compilation for project changes in cross-module dependencies. The new approach lifts previous ...
Read more >
How to get rid of Incremental annotation processing requested ...
I recently enabled data binding to my android (kotlin) project and started getting this warning. Adding the property as stated above worked for ......
Read more >
Spring @Qualifier Annotation | Baeldung
In this tutorial, we'll explore what the @Qualifier annotation can help us with, which problems it solves, and how to use it.
Read more >
obsidian-codemirror-options | Plugin library
build Reuse. obsidian-codemirror-options releases are available to install and integrate. Installation instructions, examples and code snippets are ...
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