简体   繁体   English

在IntelliJ中找不到符号变量DaggerAppComponent

[英]Cannot find symbol variable DaggerAppComponent in IntelliJ

I cloned this project https://github.com/robohorse/RoboPOJOGenerator and trying to build with the help of IntelliJ IDE. 我克隆了这个项目https://github.com/robohorse/RoboPOJOGenerator,并尝试在IntelliJ IDE的帮助下进行构建。

It is imported succesfully and downloaded necessary dependencies but it fails when I rebuild it. 它已成功导入并下载了必要的依赖关系,但是在重建它时失败。

Error:(10, 24) java: cannot find symbol
  symbol:   variable DaggerAppComponent
  location: class com.robohorse.robopojogenerator.injections.Injector

I have tried many threads of stackoverflow but didn't work for me. 我尝试了许多stackoverflow的线程,但对我没有用。 Is this something with gradle or dagger. 这是带有摇篮或匕首的东西。

buildscript {
    repositories {
        mavenCentral()
        maven { url "http://dl.bintray.com/jetbrains/intellij-plugin-service" }
        maven { url "https://plugins.gradle.org/m2/" }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    }
    dependencies {
        classpath "net.ltgt.gradle:gradle-apt-plugin:0.9"
        classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.2.0-SNAPSHOT"
        classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.1'
    }
}
apply plugin: "java"
apply plugin: "idea"
apply plugin: "org.jetbrains.intellij"
apply plugin: "net.ltgt.apt"
apply plugin: "jacoco"
apply plugin: 'com.github.kt3k.coveralls'

compileJava {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}

jacocoTestReport {
    reports {
        xml.enabled = true
        html.enabled = true
    }
}

coveralls {
    jacocoReportPath = "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}

repositories {
    mavenCentral()
}

group "com.robohorse.robopojogenerator"
version "1.8.3"

intellij {
    pluginName "RoboPOJOGenerator"
    intellij.updateSinceUntilBuild false
    //intellij.localPath = "/Applications/IntelliJ IDEA CE.app/Contents"
}

ext.daggerVersion = '2.7'

dependencies {
    testCompile "junit:junit:4.12"
    testCompile 'org.mockito:mockito-core:2.0.86-beta'

    compile "com.intellij:annotations:+@jar"
    compile 'org.json:json:20160212'
    compile 'commons-io:commons-io:2.4'
    compile 'com.google.guava:guava:19.0'

    compile "com.google.dagger:dagger:$daggerVersion"
    apt "com.google.dagger:dagger-compiler:$daggerVersion"
    compile "javax.annotation:jsr250-api:1.0"

    compile 'com.fifesoft:rsyntaxtextarea:2.6.0'
}
**@Singleton**
@Component(modules = AppModule.class)
public interface AppComponent {
...
}

Make sure you have @Singleton annotated for your component. 确保为组件添加了@Singleton批注。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM