Dagger 2,有时在编译时我得到“找不到符号类 DaggerApplicationComponent”

2024-03-30

最近更新 Android Studio (2.0.7) 后(也许这就是原因),有时在构建时我会收到该错误。

想法是通常编译进展顺利,但有时我会遇到匕首错误。

Dagger 配置可能有问题吗?

错误本身:

Executing tasks: [:app:assembleDebug]

按需配置是一项正在孵化的功能。 增量java编译是一个正在孵化的特性。 :app:preBuild 最新 :app:preDebugBuild 最新 :app:检查调试清单 :app:preReleaseBuild 最新 :app:prepareComAndroidSupportAppcompatV72311库最新 :app:prepareComAndroidSupportDesign2311Library 最新 :app:prepareComAndroidSupportMultidex101Library 最新 :app:prepareComAndroidSupportRecyclerviewV72311库最新 :app:prepareComAndroidSupportSupportV42311库最新 :app:prepareComDaimajiaSwipelayoutLibrary120Library UP-TO-DATE :app:prepareComF2prateekRxPreferencesRxPreferences101Library 最新 :app:prepareComGithubAakiraExpandableLayout141Library 最新 :app:prepareComGithubAfollestadMaterialDialogsCore0842Library 最新 :app:prepareComGithubCastorflexSmoothprogressbarLibraryCircular120Library 最新 :app:prepareComJakewhartonRxbindingRxbinding030Library 最新 :app:prepareComPnikosisMaterialishProgress17Library 最新 :app:prepareComTrelloRxlifecycle040库已更新 :app:prepareComTrelloRxlifecycleComponents040库最新 :app:prepareComWdullaerMaterialdatetimepicker211Library 最新 :app:prepareIoReactivexRxandroid110Library 最新 :app:prepareMeRelexCircleindicator116Library 最新 :app:prepareMeZhanghaiAndroidMaterialprogressbarLibrary114Library UP-TO-DATE :应用程序:准备调试依赖项 :app:compileDebugAidl 最新 :app:compileDebugRenderscript 最新 :app:generateDebugBuildConfig 最新 :app:generateDebugAssets 最新 :app:mergeDebugAssets 最新 :app:generateDebugResValues 最新 :app:generateDebugResources 最新 :app:mergeDebugResources 最新 :app:processDebugManifest 最新 :app:processDebugResources 最新 :app:generateDebugSources 最新 :app:compileDebugJavaWithJavac /home/ungvas/AndroidDev/Projects/FW/paynet-android/app/src/main/java/md/fusionworks/paynet/ui/activity/BaseActivity.java:23:错误:找不到符号 导入 md.fusionworks.paynet.di.component.DaggerActivityComponent; ^ 符号:DaggerActivityComponent 类 位置:包 md.fusionworks.paynet.di.component /home/ungvas/AndroidDev/Projects/FW/paynet-android/app/src/main/java/md/fusionworks/paynet/PaynetApplication.java:7:错误:找不到符号 导入 md.fusionworks.paynet.di.component.DaggerApplicationComponent; ^ 符号:DaggerApplicationComponent 类 位置:包 md.fusionworks.paynet.di.component 2 个错误

66 个类的增量编译在 3.719 秒内完成。 :app:compileDebugJavaWithJavac 失败 :应用程序:编译Retrolambda调试

失败:构建失败并出现异常。

  • 什么地方出了错: 任务“:app:compileDebugJavaWithJavac”执行失败。

    编译失败;有关详细信息,请参阅编译器错误输出。

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。

构建失败

总时间:19.556秒


看来和Gradle 2.10中添加的增量编译有关

我设法修复它,将以下命令添加到 gradle:

-Pandroid.incrementalJavaCompile=false

您可以将其添加到 Android Studio 中:文件|设置|构建、执行、部署 |编译器将其添加为命令行选项.

edit as of 2.0.0-beta3该插件会发出警告,告诉您此选项已添加到 Gradle DSL 中:

android {
    compileOptions.incremental = false
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Dagger 2,有时在编译时我得到“找不到符号类 DaggerApplicationComponent” 的相关文章

随机推荐