- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
编译我的应用程序时,我在所有生成的 WhatFragmentOrActivityBinding 类上都收到以下错误:
error: cannot find symbol
protected WhateverFragmentOrActivityBinding(DataBindingComponent _bindingComponent, View _root,
^
symbol: class DataBindingComponent
location: class WhateverFragmentOrActivityBinding
DataBindingComponent
类似乎没有生成。
查看 DataBindingComponent
的文档,我们看到:
If using Dagger 2, the developer should extend this interface and annotate the extended interface as a Component.
我确实在使用 Dagger 2,所以我怀疑这可能是相关的。我自己尝试过这样做,但无济于事,并且无法在互联网上找到它。这是我尝试过的:
@Component(dependencies = [AppComponent::class], modules = [(AppModule::class), (AndroidInjectionModule::class), (ActivityBuilderModule::class)])
interface BindingComponent : DataBindingComponent
但是,由于我已经遇到了找不到符号错误,因此永远不会生成 DaggerBindingComponent 类。这似乎是一个先有鸡还是先有蛋的问题,所以我不确定这是否能解决我的问题。
DataBindingComponent 似乎负责处理 BindingAdapter。我有一些用于绑定(bind) ImageView src 属性的自定义绑定(bind)适配器,但即使注释掉这些适配器也无济于事,所以我不确定它们是否相关。
我尝试从应用程序中完全删除 Dagger,但问题并没有消失。不知道还能尝试什么
u_u
最佳答案
几天前我遇到了同样的问题,我正在使用产品 flavor ,其中一个(我目前正在研究的那个)无法访问所需的类,这导致所有绑定(bind)类都失败,我在每个 Activity 或 Fragment 绑定(bind)类上都遇到了多个错误。
我也在使用 Dagger2,但我的一个模块无法访问类 (CustomBroadcastReceiver)
@Module
abstract class BroadcasReceiverModule {
@ContributesAndroidInjector
internal abstract fun contributePhoneStateBroadcastReceiver(): CustomBroadcastReceiver
}
在构建过程之后从未显示此错误,BroadcastReceiverModule 是我的“主要”资源的一部分,但它不是我正在处理的 CustomBroadcastReceiver 不存在的 flavor 所必需的
即使它不是必需的,它仍然会产生一堆错误,在我从“主要”资源中删除 BroadcastReceiverModule 并将其仅放置在实际需要的风格上后消失了
关于android - 使用 dagger2 时未生成 DataBindingComponent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50527819/
这个问题在这里已经有了答案: How do I access an instance variable inside a BindingAdapter when using Android Data
我正面临这种幻像错误。我已经尝试了很多方法来解决这个问题,但没有任何效果。我不知道是什么产生了这个问题。这是我在构建日志中的错误: e: /Users/galihlarasprakoso/Projec
将我的整个项目迁移到 android x 后,我无法再编译它了。 我收到 100 个以下错误: e: M:\tmp\EverywhereLauncher\app\generated\data_bind
我在 Glide 成功渲染图像后更新 TextView 时看到此错误。 Fatal Exception: java.lang.IllegalStateException: Required DataB
在我的 agent_details_activity.xml 中: Activity 中: class AgentDetailsActivity : AppCompatActivity() {
我正在尝试将 Dagger2 与 Kotlin 结合使用,但出现无法追踪的错误。我已经尝试了很多方法来解决这个问题,但都不起作用。这是我通过 ./gradlew build --stacktrace
编译我的应用程序时,我在所有生成的 WhatFragmentOrActivityBinding 类上都收到以下错误: error: cannot find symbol protected Wha
我在 android studio 中构建时遇到了这个错误: Error:Execution failed for task ':app:transformResourcesWithMergeJava
我下载了一个 Android 项目,但出现了这个错误: Error:(42, 42) error: cannot find symbol class DataBindingComponent 示例导入
我在官方 API 文档中看到了 DataBindingComponent。 https://developer.android.com/reference/android/databinding/Da
我有一个项目,我在 android studio 3.3 中使用 dagger 版本 2.18(实现“com.google.dagger:dagger:2.18”) Beta 1 但是当我运行它时,它
我已经尝试解决这个烦人的问题太久了,但没有任何进展。 我们的应用程序有大部分类是用 Kotlin 编写的,我们也在使用数据绑定(bind): apply plugin: "kotlin-kapt"
我刚刚在启用了 Kotlin 的 Android Studio 3.3 Canary 3 上创建了一个新项目。然后我还启用了数据绑定(bind),但我收到一条错误消息,提示找不到 DataBindin
我刚刚在启用 Kotlin 的 Android Studio 3.2 Canary 16 上创建了一个新项目。然后我也启用了数据绑定(bind),但是我收到一个错误,说它找不到 DataBinding
我是一名优秀的程序员,十分优秀!