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("com.something.xyz") }) 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 [project-name.core.network.unitTest] was removed from modules [project-name.core.network.androidTest]"

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 ?

Hi!

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 {
    id("com.apollographql.apollo3").version("3.6.0")
}
dependencies {
    implementation("com.apollographql.apollo3:apollo-runtime:3.6.0")
}

// apollo { packageName.set("com.something.netwrok.model") }
// OR below apollo {} block - both has the same warning.
apollo {
    createAllAndroidVariantServices(".", "") {
        packageName.set("com.something.netwrok.model")
        schemaFile.set(file("src/main/graphql/com/something/netwrok/schema.graphqls"))

        introspection {
            if (name.contains("release")) {
                endpointUrl.set("productionUrl")
            } else {
                endpointUrl.set("developmentUrl")
            }
        }
    }
}

Hi!

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