Android gradle buildTypes: Duplicate class

后端 未结 2 1089
余生分开走
余生分开走 2020-12-28 14:00

I\'m converting my app to use gradle, and I\'m trying to use the buildTypes. I have a Constants class which I wish to modify for my release build. So I have a f

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-28 14:48

    You can not have a class in main and release. You need to split it into something like debug and release.

    gradle will merge the source sets for each buildType with main.
    This is the reason, why the class gets duplicated in your release build.

    So the rule is: put a class into main, or in every buildType but not both.

提交回复
热议问题