Product Flavor: Duplicate class found

The documentation for variants states (emphasis mine):

Note: For a given build variant, Gradle throws a build error if it
encounters two or more source set directories that have defined the
same Java class. For example, when building a debug APK, you cannot
define both src/debug/Utility.java and src/main/Utility.java. This is
because Gradle looks at both these directories during the build
process and throws a ‘duplicate class’ error. If you want different
versions of Utility.java for different build types, you can have each
build type define its own version of the file and not include it in
the main/ source set
.

So the solution is to have it’s own version of Bar.kt per variant and exclude it from main source set.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)