Dagger 2,有时在编译时会出现“找不到符号类DaggerApplicationComponent”。 [英] Dagger 2, sometimes on compiling I get "cannot find symbol class DaggerApplicationComponent"

查看:595
本文介绍了Dagger 2,有时在编译时会出现“找不到符号类DaggerApplicationComponent”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近更新Android Studio(2.0.7)之后(也许是原因),有时在构建时会出现该错误。

Recent after update Android Studio (2.0.7) (maybe this is the cause) sometimes when building i get that error.

想法是通常编译会顺利进行但有时我会出现匕首错误。

Idea is that usually compilation goes well but sometimes I get dagger error.

在Dagger配置中是否可能出现问题?

Is possible that is problem in Dagger configuration?

错误本身:


执行任务:[:app:assembleDebug]

Executing tasks: [:app:assembleDebug]

在需求是一个孵化功能。
增量Java编译是一个孵化功能。
:app:preBuild迄今为止
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRebrary-UP $ 723 b $ b:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComDaimajiaSwipelayoutLibrary120Library UP-TO-DATE
:app:prepareComF2prateekRxPreferencesRxPreferences101Library UP-TO-Date $ Apply-ParparePark DATE
:app:prepareComGithubAfollestadMaterialDialogsCore0842Library UP-TO-DATE
:app:prepareComGithubCastorflexSmoothprogressbarLibraryCircular120Library UP-TO-DATE
:app:parpareComJakewteriaUPLiDary:030至今
:app:prepa reComTrelloRxlifecycle040Library UP-TO-DATE
:app:prepareComTrelloRxlifecycleComponents040Library UP-TO-DATE
:app:prepareComWdullaerMaterialdatetimepicker211Library UP-TO-DATE
:app:prepareUP-Library app:prepareMeRelexCircleindicator116Library UP-TO-DATE
:app:prepareMeZhanghaiAndroidMaterialprogressbarLibrary114Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAappl UP-TO-DATE
:R UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
: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:错误:找不到符号
import 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:错误:找不到符号
import md.fusionworks.paynet.di.component.DaggerApplicationComponent;
^
符号:类DaggerApplicationComponent
位置:包md.fusionworks.paynet.di.component
2错误

Configuration on demand is an incubating feature. Incremental java compilation is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE :app:prepareComAndroidSupportDesign2311Library UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE :app:prepareComDaimajiaSwipelayoutLibrary120Library UP-TO-DATE :app:prepareComF2prateekRxPreferencesRxPreferences101Library UP-TO-DATE :app:prepareComGithubAakiraExpandableLayout141Library UP-TO-DATE :app:prepareComGithubAfollestadMaterialDialogsCore0842Library UP-TO-DATE :app:prepareComGithubCastorflexSmoothprogressbarLibraryCircular120Library UP-TO-DATE :app:prepareComJakewhartonRxbindingRxbinding030Library UP-TO-DATE :app:prepareComPnikosisMaterialishProgress17Library UP-TO-DATE :app:prepareComTrelloRxlifecycle040Library UP-TO-DATE :app:prepareComTrelloRxlifecycleComponents040Library UP-TO-DATE :app:prepareComWdullaerMaterialdatetimepicker211Library UP-TO-DATE :app:prepareIoReactivexRxandroid110Library UP-TO-DATE :app:prepareMeRelexCircleindicator116Library UP-TO-DATE :app:prepareMeZhanghaiAndroidMaterialprogressbarLibrary114Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:compileDebugJavaWithJavac /home/ungvas/AndroidDev/Projects/FW/paynet-android/app/src/main/java/md/fusionworks/paynet/ui/activity/BaseActivity.java:23: error: cannot find symbol import md.fusionworks.paynet.di.component.DaggerActivityComponent; ^ symbol: class DaggerActivityComponent location: package md.fusionworks.paynet.di.component /home/ungvas/AndroidDev/Projects/FW/paynet-android/app/src/main/java/md/fusionworks/paynet/PaynetApplication.java:7: error: cannot find symbol import md.fusionworks.paynet.di.component.DaggerApplicationComponent; ^ symbol: class DaggerApplicationComponent location: package md.fusionworks.paynet.di.component 2 errors

66个课程的增量编译在3.719秒内完成。
:app:compileDebugJavaWithJavac失败
:app:compileRetrolambdaDebug

Incremental compilation of 66 classes completed in 3.719 secs. :app:compileDebugJavaWithJavac FAILED :app:compileRetrolambdaDebug

失败:生成失败,出现异常。

FAILURE: Build failed with an exception.


  • 出了什么问题:
    任务':app:compileDebugJavaWithJavac'的执行失败。

  • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.


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

Compilation failed; see the compiler error output for details.


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

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    构建失败

    总时间:19.556秒


    谢谢。

    Total time: 19.556 secs
    Thanks.

    推荐答案

    似乎与Gradle 2.10中添加的增量编译有关。

    It's seems that it have something to do with incremental compilation added in Gradle 2.10

    我设法通过添加以下命令来对其进行修复:

    I managed to fix it adding the following command to gradle:

    -Pandroid.incrementalJavaCompile=false
    

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

    You can add it in Android Studio in: File | Settings | Build, Execution, Deployment | Compiler adding it as a Command line option.

    edit 2.0起。 0-beta3 插件发出警告,告诉您此选项已添加到Gradle DSL:

    edit as of 2.0.0-beta3 the plugin gives a warning telling you that this option has been added to the Gradle DSL:

    android {
        compileOptions.incremental = false
    }
    

    这篇关于Dagger 2,有时在编译时会出现“找不到符号类DaggerApplicationComponent”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆