Gradle error: configuration declares dependency which is not declared

In Android Studio 3.0 the documentation for Migrate to the New Plugin says:

dependencies {
    // This is the old method and no longer works for local
    // library modules:
    // debugCompile project(path: ':foo', configuration: 'debug')
    // releaseCompile project(path: ':foo', configuration: 'release')

    // Instead, simply use the following to take advantage of
    // variant-aware dependency resolution. You can learn more about
    // the 'implementation' configuration in the section about
    // new dependency configurations.
    implementation project(':foo')

    // You can, however, keep using variant-specific configurations when
    // targeting external dependencies. The following line adds 'app-magic'
    // as a dependency to only the 'debug' version of your module.

    debugImplementation 'com.example.android:app-magic:12.3'
}

So change this

    debugCompile project(path: ':foo', configuration: 'debug')
    releaseCompile project(path: ':foo', configuration: 'release')

to this

    implementation project(':foo')

Leave a Comment