Machapisho

ionic cordova fail to build app with duplicate elements (CAMERA) at AndroidManifest.xml

Picha
Hi Every one! I would like to share a solution for below error after I have suffered with it for couple of days. CAUSE OF THE ERROR This is error occurs when there are two or more same xml elements in the AndroidManifest.xml file. as shown on the figure below This duplication occurs if you add two plugins that use camera (i.e barcodescanner and camera plugin ). Each of the two plugins has a file called  plugin.xml  found in  ./plugins/plugin_name/plugin.xml . The elements (e.g  uses-permission android:name="android.permission.CAMERA" ) are also added to the android.json file found in  ./platform/android/android.json  NOW, when build the  app , The merger tool combines all the manifest files (plugins.xml) into one file (AndroidManifest.xml file) by merging them sequentially based on each manifest file's priority. (Ref:  Merge multiple manifest files ) If the merging tool found the element from one manifest file (plugin.xml file) wh...