Could not find com.google.dagger:dagger-compiler:3

2019-08-27 21:09发布

I have imported project from Eclipse and I got so many errors and I resolved all of them now in the end after successful build, I'm getting error:

Could not find com.google.dagger:dagger-compiler:3.0.0

Code in build.gradle(project) is

    buildscript {

    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'

        classpath 'com.google.gms:google-services:3.2.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

and code in build.gradle(module:app) is

    android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.thanu.schoolbustracker"
        minSdkVersion 24
        targetSdkVersion 27
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    annotationProcessor 'com.google.dagger:dagger-compiler:3.0.0'
    compile 'com.android.support:support-v4:27.0.0'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile files('libs/google-play-services.jar')
    compile files('libs/maps.jar')
    compile 'com.android.support:support-annotations:27.0.2'
    compile 'com.android.support:support-v13:27.0.2'
    compile 'com.android.support:appcompat-v7:27.0.2'
    compile 'com.android.support:support-vector-drawable:27.0.2'
    compile 'com.android.support:design:27.0.2'
    compile 'com.android.support:gridlayout-v7:27.0.2'
    compile 'com.android.support:mediarouter-v7:27.0.2'
    compile 'com.android.support:cardview-v7:27.0.2'
    compile 'com.android.support:palette-v7:27.0.2'
    compile 'com.android.support:leanback-v17:27.0.2'
    compile 'com.android.support:recyclerview-v7:27.0.2'
    compile 'com.android.support:exifinterface:27.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.1.0'
    compile 'com.android.support.test:runner:1.0.1'
    compile 'com.android.support.test.espresso:espresso-core:3.0.2'
    compile 'com.android.support.test.espresso:espresso-contrib:3.0.2'
    compile 'com.android.databinding:library:3.1.2'
    compile 'com.android.databinding:baseLibrary:3.1.2'
    compile 'com.android.databinding:compiler:3.1.2'
    compile 'com.android.databinding:adapters:3.1.2'
    compile 'com.google.android.gms:play-services-ads:15.0.0'
    compile 'com.google.android.gms:play-services-wearable:15.0.0'
    compile 'com.google.android.gms:play-services-maps:15.0.0'
    compile 'com.google.android.support:wearable:2.3.0'
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

After rebuild, project is built successfully but it is not creating APK and giving error;

Could not find com.google.dagger:dagger-compiler:3.0.0

1条回答
唯我独甜
2楼-- · 2019-08-27 22:13

Right now the latest version of Dagger is 2.15, change this line:

annotationProcessor 'com.google.dagger:dagger-compiler:2.15'

Also other Dagger libraries are:

compile "com.google.dagger:dagger:2.15"
compile "com.google.dagger:dagger-android:2.15"
compile "com.google.dagger:dagger-android-support:2.15"
annotationProcessor "com.google.dagger:dagger-android-processor:2.15"
查看更多
登录 后发表回答