Search code examples
androidcordovaandroid-manifestbarcode-scannerphonegap

Duplicated element in AndroidManifest.xml with Cordova


The build process ends with the following error:

BUILD FAILED in 3s
(node:8976) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
    \platforms\android\app\src\main\AndroidManifest.xml:20:5-60 Error:
            Element uses-feature#android.hardware.camera at AndroidManifest.xml:20:5-60 duplicated with element declared at AndroidManifest.xml:19:5-84

The problem is that i have these two lines in my AndroidManifest.xml:

<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera" />

The only plugin installed is phonegap-plugin-barcodescanner (version 7.0.2) and here are the versions used:

  • Cordova: 8.0.0
  • Android: 7.0.0

How can I remove the duplicated entry in the XML file? Even if I remove it manually it obviously comes back after the next build process.


Solution

  • I've created a brand new app (but with the old assets), installed again both android platform and the plugin and everything works fine now.