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.

'org.jetbrains.annotations.NotNull' could not be resolved

See original GitHub issue

Hello!

I’m an Android developer and I use Dagger in my project. The project is written in Kotlin. I’ve updated Dagger version to 2.41. Since that the project hasn’t built. The build is failed with error:

ComponentProcessingStep was unable to process ‘this.package.name.AppComponent’ because ‘org.jetbrains.annotations.NotNull’ could not be resolved.

I’ve added Gradle dependency in my classpath:

dependencies {
    ....
    compileOnly("org.jetbrains:annotations:23.0.0")
    ....
    kapt("com.google.dagger:dagger-compiler:2.41")
}

but it didn’t help…

How to fix this?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
Lesya666commented, Feb 27, 2022

@bcorso, @tbroyer thank you very much for your replies!

I’ve found the problem. Dependency org.jetbrains.annotations.NotNull isn’t needed. I didn’t notice the following in the :app module gradle file:

configurations {
    implementation.get().exclude("org.jetbrains", "annotations")
}

If I remove this, the project will be built without errors. Exclusion org.jetbrains.annotations from application configurations worked with dagger versions till 2.41

0reactions
bcorsocommented, Feb 25, 2022

Hmm, is there any way you could create a sample project that reproduces this so that I can take a look?

My only guess is that you’re adding the dependency to the wrong Gradle module. Can you show the task that failed (should be right above the error message, e.g. > Task :someModule:someTask FAILED). You’ll want to make sure you’re adding the dependency to the :someModule Gradle module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

editor does not find library containing @NotNull annotation
However, the editor fails to find the library. It highlights "jetbrains" in red and says it can't resolve the symbol. Same for @NotNull....
Read more >
importing NotNull or Nullable and Android Studio won't compile
Go to File / Setting → Project Settings → Inspections and search for "nullable". In Constant conditions & exceptions and @NotNull/@Nullable problems, click ......
Read more >
@org.jetbrains.annotations.NotNull [Solved] - YouTube
org. jetbrains. annotations. NotNull problem in android studio, caused while updating android studio. ... Your browser can't play this video.
Read more >
Org.jetbrains.annotations.NotNull problem with android build
Hi. I created a java library project and it uses org.jetbrains.annotations.NotNull annotation. (I added annotations.jar from intellij installation.)
Read more >
Databinding v2 produces errors when another annotation ...
MainActivity cannot be provided without an @Inject constructor or an @Provides-annotated method. public abstract void inject(@org.jetbrains.annotations.NotNull ...
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