question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dagger 2.10 DaggerAppComponent cannot find error after add realm to build.gradle

See original GitHub issue

Hi, I’m using dagger 2.10 and realm 3.2.0 but after add realm dagger can’t generate Dagger*Component. I’m for test remove realm dependency from .gradle file, after this work correctly It’s project gradle file

    ext.kotlin_version = '1.1.2-3'
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.4.0-alpha7'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.realm:realm-gradle-plugin:3.1.4"
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
It's app gradle file
apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
apply plugin: 'realm-android'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "uz.uzgps.android.viewer"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    packagingOptions {
        exclude 'META-INF/rxjava.properties'
    }
    compileOptions.incremental = false
}
dependencies {
//    def dagger = "2.11-rc2" //is not release
    def dagger = "2.10"
    def support = "25.3.1"
    def rxBinding = "2.0.0"
    def timber = "4.5.1"
    def osmDroid = "5.6.4"
    def mkLoader = "1.2.0"
    def gson = "2.8.0"
    def retrofit = "2.2.0"
    def chuck = "1.0.4"
    def butterKnife = "8.5.1"

    compile fileTree(include: ["*.jar"], dir: "libs")
    compile "com.android.support:appcompat-v7:" + support
    compile "com.android.support:design:" + support
    compile "com.android.support:support-v4:" + support
    compile "com.android.support:support-vector-drawable:" + support
    compile "com.android.support:recyclerview-v7:" + support
    compile "com.android.support:percent:" + support
    compile "com.android.support:cardview-v7:" + support
    compile "com.android.support.constraint:constraint-layout:1.0.2"

    compile "com.jakewharton.rxbinding2:rxbinding:" + rxBinding
    compile "com.jakewharton.rxbinding2:rxbinding-support-v4:" + rxBinding
    compile "com.jakewharton.rxbinding2:rxbinding-appcompat-v7:" + rxBinding
    compile "com.jakewharton.rxbinding2:rxbinding-design:" + rxBinding
    compile "com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:" + rxBinding

    compile "com.jakewharton.timber:timber:" + timber
    compile "org.osmdroid:osmdroid-android:" + osmDroid
    compile "com.edwardvanraak:MaterialBarcodeScanner:0.0.6-ALPHA"
    compile "com.tuyenmonkey:mkloader:" + mkLoader
    compile 'com.github.devlight:infinitecycleviewpager:1.0.2'

    compile "com.google.code.gson:gson:" + gson
    compile "com.squareup.retrofit2:retrofit:" + retrofit
    compile "com.squareup.retrofit2:converter-gson:" + retrofit
    compile "com.squareup.retrofit2:adapter-rxjava2:" + retrofit

    debugCompile "com.readystatesoftware.chuck:library:" + chuck
    releaseCompile "com.readystatesoftware.chuck:library-no-op:" + chuck

    compile "io.reactivex.rxjava2:rxjava:2.1.0"
    compile "io.reactivex.rxjava2:rxandroid:2.0.1"

    compile "com.google.dagger:dagger:" + dagger
    compile "com.google.dagger:dagger-android:" + dagger
    compile "com.google.dagger:dagger-android-support:" + dagger
    annotationProcessor "com.google.dagger:dagger-compiler:" + dagger
    annotationProcessor "com.google.dagger:dagger-android-processor:" + dagger

    compile "com.jakewharton:butterknife:" + butterKnife
    annotationProcessor "com.jakewharton:butterknife-compiler:" + butterKnife
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:" + kotlin_version

//    compile "org.mapsforge:mapsforge-map-android:0.6.1"
//    compile "org.mapsforge:mapsforge-map:0.6.1"

    debugCompile "com.squareup.leakcanary:leakcanary-android:1.5"
    releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:1.5"
    testCompile "com.squareup.leakcanary:leakcanary-android-no-op:1.5"

}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
Zhuindencommented, May 16, 2017

I think you need to replace

annotationProcessor "com.google.dagger:dagger-compiler:" + dagger
annotationProcessor "com.google.dagger:dagger-android-processor:" + dagger

compile "com.jakewharton:butterknife:" + butterKnife
annotationProcessor "com.jakewharton:butterknife-compiler:" + butterKnife

with

kapt "com.google.dagger:dagger-compiler:" + dagger
kapt "com.google.dagger:dagger-android-processor:" + dagger

compile "com.jakewharton:butterknife:" + butterKnife
kapt "com.jakewharton:butterknife-compiler:" + butterKnife

and also you need to apply kotlin-kapt plugin

apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

and add

kapt {
    generateStubs = true
}
2reactions
Zhuindencommented, Aug 31, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dagger 2, sometimes on compiling I get "cannot find symbol ...
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...
Read more >
How to get started with Dagger 2 on Android
To tell Dagger to provide dependencies you first need to inject your appComponent. You do this by adding a function that takes a...
Read more >
Dependency Injection with Dagger 2 - CodePath Cliffnotes
The Dagger compiler generates code that is used to create the dependency graph of the classes defined in your source code. These classes...
Read more >
the kotlin gradle plugin was loaded multiple times in different ...
When I try to launch any tasks from gradle I get the error: ... If the parent project does not need the plugin,...
Read more >
Android Studio 3.5 Canary 13 - Undefined value encountered ...
Canary 13 creates this error when building release build. Gradle 5.4 > Task :app:transformClassesAndResourcesWithR8ForRelease. R8 is a new Android code ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found