android - 缺少 dagger2 编译错误

标签 android dagger-2

我在读取 dagger2 编译错误时遇到问题。例如,我有一个 NotNull 注释,我没有在 build.gradle 中为其提供正确的依赖项,但是 dagger 没有给出编译错误的实际原因,但只显示有问题的文件:

error: [ComponentProcessor:MiscError] dagger.inter nal.codegen.ComponentProcessor was unable to process this class because not all of its dependencies could be resolved. Check for compila tion errors or a circular dependency with generated code.

最后的错误来自 kapt:

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction java.lang.reflect.InvocationTargetException (no error message)

我总是能够以某种方式追踪问题的原因,但这非常令人沮丧。 NotNull 的上述问题通常会以编译错误结束,但由于 dagger 在编译之前运行,所以我没有机会看到此错误。

是否有一些选项可以让 dagger 变得更加冗长并出现错误?我将升降机错误限制为 2500,但仍然没有出现更好的错误。

我目前使用 AGP 7.0.1 和 dagger2 2.38.1 版本

最佳答案

我上次也遇到了同样的问题,但是通过删除项目的“build”文件夹设法解决了这个问题。

enter image description here

但最终,我无法找出问题的根本原因。

如果您还没有尝试过,请尝试删除这些构建文件夹并重建项目。

关于android - 缺少 dagger2 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68942769/

相关文章:

android - 在测试应用程序中使用 Dagger 和 Robolectric

java - Dagger 2 : Multiple entries with same key

Android 无法在项目上创建 Dagger

java - setText ("") 导致 Android 应用程序崩溃

android - 实时模板在 Kotlin 中不起作用

java - Android - 套接字超时

java - 在 Dagger 2 中使用 AndroidInjections 贡献模块(抽象类)作为子组件

java - Dagger-带有继承的Android Activity注入(inject): "This type supports members injection but cannot be implicitly provided."

Android为图像添加半透明叠加层

android - 为什么要使用接口(interface)从 fragment 到 Activity 进行通信?