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
```buildscript {
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"
}
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
}
work :+1: ,thanks :)
thanks. i get the same problem when using dagger 2.11 & realm 3.3.2, but now it works
@singamasae I got the same problem.Can you tell me how did you resolve this issue?
@sbLaughing I assume following the instructions in https://github.com/realm/realm-java/issues/4650#issuecomment-301743174
Hi,
here is my Gradle code
apply plugin: 'maven'
apply plugin: 'com.android.library'
//apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
I am trying to add a dagger in my root library and got an error as below. Please, anyone, suggest
error: cannot find symbol
import com.example.simpledagger.di.components.DaggerAppComponent;
Check the compiler output for errors in the Build tab.
Most helpful comment
I think you need to replace
with
and also you need to apply
kotlin-kaptpluginand add