I get following errors while setting up dagger 2.x in Android Studio 3.0 Canary 4
Error:(71, 20) Failed to resolve: com.google.dagger:dagger:2.x
Error:(73, 20) Failed to resolve: com.google.dagger:dagger-android:2.x
Error:(74, 20) Failed to resolve: com.google.dagger:dagger-android-support:2.x
My build files are like below:
dependencies {
//For DI - Dagger 2
implementation 'com.google.dagger:dagger:2.x'
annotationProcessor 'com.google.dagger:dagger-compiler:2.x'
implementation 'com.google.dagger:dagger-android:2.x' // If you're using classes in dagger.android
implementation 'com.google.dagger:dagger-android-support:2.x' // if you use the support libraries
annotationProcessor 'com.google.dagger:dagger-android-processor:2.x'
}
The project build file has below snippets
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}
Your help is appreciated...
If you're like me to have got into this problem, this is what I did to get out of this situation.
I went to https://github.com/google/dagger/releases to figure out the latest release version of dagger, and found v2.11 to be the latest as on date. I replaced 2.x with 2.11 in the version portion for this libraries configuration in the build file and bingo the build is successful.
dependencies {
//For DI - Dagger 2
implementation 'com.google.dagger:dagger:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
implementation 'com.google.dagger:dagger-android:2.11' // If you're using classes in dagger.android
implementation 'com.google.dagger:dagger-android-support:2.11' // if you use the support libraries
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
}