Android: Warning `Duplicate content roots detected` after just adding apollo3 kotlin client

Android Studio Chipmunk | 2021.2.1 Patch 2
Apollo kotlin version 3.6.0

After just adding apollo3 gradle setup like plugin, dependency and apollo block (apollo { packageName.set("") }) as per get started guide.
Android studio shows warning on gradle sync as following:

Duplicate content roots detected
Path [/ProjectName/core/network/build/generated/source/apolloTest/debugUnitTest] of module [] was removed from modules []"

When we run unit tests It causes issues like unit test not found even if we have unit tests.
Any solution to fix this warning ?


This doesn’t ring a bell except than I’ve seen multiple problems with running unit tests from within Android Studio before. Can you confirm whether you have the same issue independently of having Apollo in your project or not?

Also are your unit tests run as expected from the command line?

Not sure why unit tests started working fine now but the warning on gradle sync is still there.

The project is multi-module project but I have configured apollo for only 1 module called network module. We do not want to use apollo outside the network module.

So now I am looking to fix the only warning.

FYI: I have also tried creating new empty activity project and added below setup in app module but the warning is still there.
Here is the setup that I did in the module:

plugins {
dependencies {

// apollo { packageName.set("com.something.netwrok.model") }
// OR below apollo {} block - both has the same warning.
apollo {
    createAllAndroidVariantServices(".", "") {

        introspection {
            if (name.contains("release")) {
            } else {


Your Apollo configuration looks good to me.

I wonder if the warning is related to this issue, which seems to be fixed with recent versions of AGP/AS.

It seems like issue is android studio version specific after reading some details from here.
Upgrading android studio to electric eel will solve this issue.

Thanks @Benoit_Lubek

Upgrading android studio to Electric eel has also not solved the issue.
Following solution is what worked and warning is now gone.
Official doc reference link

apollo {
    service("service") {
        outputDirConnection {
            connectToKotlinSourceSet("main") // main is by default but setting this explicitly fixed the warning.