0

In the past, the rule was:
put a class into main, or in every buildType, but not both

ref1 and ref2

But the current doc clearly says that Gradle now supports overriding, if the same file exists in different sourceSets (e.g., main and debug):

If different source sets contain different versions of the same file, Gradle uses the following priority order when deciding which file to use (source sets on the left override the files and settings of source sets to the right):

build variant > build type > product flavor > main source set > library dependencies

from here.

But it doesn't work! It still complains about "duplicate" classes if you have foo.java present in both main and release folders! Anyone has any idea whether this is a bug in android studio or gradle or just a mistake on their docs?

Community
  • 1
  • 1
Kasra
  • 3,045
  • 3
  • 17
  • 34

0 Answers0