The SourceSet 'robolectric' is not recognized by the Android Gradle Plugin
Asked Answered
B

1

3

Updated to Android Studio 3.1 and its corresponding gradle. I'm getting a message when trying to sync "The SourceSet 'robolectric' is not recognized by the Android Gradle Plugin. Perhaps you misspelled something?".

Here is the current sourceSet in the gradle file:

sourceSets {
    main {
        java.srcDirs = ['src/main/java']
    }
    robolectric {
        java.srcDir file('src/test/java/')
        resources.srcDir file('src/test/resources')
    }
}
Bignoniaceous answered 10/4, 2018 at 12:25 Comment(1)
did you find answer? if so, please post it here..Lessard
L
0

The defined sourceSet must match an already defined buildType or productFlavor. This excludes main which is defined by default.

buildTypes {
        debug {
           //TODO: Your buildType config here
        }

        robolectric {
           //TODO: Your buildType config here
        }
}

sourceSets {
    main {
        java.srcDirs = ['src/main/java']
    }
    robolectric {
        java.srcDir file('src/test/java/')
        resources.srcDir file('src/test/resources')
    }
}
Lally answered 15/5, 2020 at 1:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.