Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type BuildConfig is defined multiple times

Tags:

android

gradle

I'm working on a multi module Android application and everything was working in a debug mode but now when I try to build a release package I'm receiving this error:

Type ***module1.BuildConfig is defined multiple times:
***/module1/build/intermediates/runtime_library_classes/release/classes.jar:***/module1/BuildConfig.class,
***/module2/build/intermediates/runtime_library_classes/release/classes.jar:***/module1/BuildConfig.class

It's the first time I'm seeing an error like this and I don't know how to fix this and what's even causing it. As far as I'm aware library modules shouldn't even be generating BuildConfig files in release mode.

like image 952
Ernest Zamelczyk Avatar asked Mar 03 '20 12:03

Ernest Zamelczyk


3 Answers

check if both modules have a same package name

like image 166
akshay_shahane Avatar answered Oct 21 '22 05:10

akshay_shahane


My Android Manifest Had the same Package Name for two Diferent Modules.

like image 35
Gilberto Ibarra Avatar answered Oct 21 '22 05:10

Gilberto Ibarra


Most probably both shared AndroidManifest.xml and androidApp AndroidManifest.xml has the same packageId. They have to be different. For example, com.my.app.shared and com.my.app.android

like image 13
Булат Мухутдинов Avatar answered Oct 21 '22 06:10

Булат Мухутдинов