androidsource-setsandroid-studio-chipmunk

SharedTest got warning "Duplicate content root detected" on Android Studio Chipmunk


After upgrade to Android Studio Chipmunk, my test failed because I can't access file inside shared folder that defined in build.gradle like this.

sourceSets {
    androidTest.java.srcDirs += "src/sharedTest/java"
    test.java.srcDirs += "src/sharedTest/java" }

It show warning pop up with message "Duplicate content root detected". Path [sharedTest] of module [unitTest] was removed from modules [androidTest]. Anyone can resolve this?


Solution

  • According to https://issuetracker.google.com/issues/232007221 ("Duplicate content roots detected" with Android Gradle plugin 7.2.0) Google no longer supports this construct in Android Studio Chipmunk 2021.2.1.

    https://issuetracker.google.com/issues/232007221#comment17 says "Source sets can no longer contain shared roots as this is impossible to represent in the IDE."

    To follow the on-going discussions, subscribe to https://issuetracker.google.com/232007221 and
    https://issuetracker.google.com/232420188