Android Studio 3.0 Gradle sync failed: java.lang.AssertionError (in UnresolvedDependenciesReporter)

The issue was I did not select defaults for missing build types. My project has 2 modules with the following build types configuration:

data/build.gradle

apply plugin: 'com.android.library'
android {
    ...
    buildTypes {
        debug { ... }
        release { ... }
    }
}

app/build.gradle

apply plugin: 'com.android.application'
android {
    ...
    buildTypes {
        debug { ... }
        dev { ... }
        qa { ... }
        rc { ... }
        release { ... }
    }
}

With the latest Android gradle plugin, your build types must match from library to application modules. My issue was my data module did not define dev,qa, and rc build types. I resolved this by using buildTypeMatching in my application module:

app/build.gradle

apply plugin: 'com.android.application'
android {
    ...

    buildTypeMatching 'dev', 'debug'
    buildTypeMatching 'qa', 'debug'
    buildTypeMatching 'rc', 'release'

    buildTypes {
        debug { ... }
        dev { ... }
        qa { ... }
        rc { ... }
        release { ... }
    }
}

You could also add the missing variants to the library modules as well.

I came across this bug report which seemed to be my same issue. Looks like there is a bug in the error messaging which hopefully will get fixed.


Just turn off offline mode. It's works for me.


In my case restarting Android Studio solved my issue