Daniel Hutton
Daniel Hutton

Reputation: 1455

Ionic native camera plugins conflicting

I have installed the plugin cordova-plugin-camera-preview link. After installing this, if I run ionic cordova build android, the app builds fine.

However, I also need to use the plugin phonegap-plugin-barcodescanner link so I have installed this as well. Now when I try to run ionic cordova build android, the build fails with the following error:

    Error:
    Element uses-feature#android.hardware.camera at AndroidManifest.xml:21:5-84 duplicated with element declared at 
AndroidManifest.xml:18:5-60
/Users/Dan/Projects/test/testApp/platforms/android/AndroidManifest.xml Error:
    Validation failed, exiting


See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:processDebugManifest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

If I then remove one of these plugins again, it builds fine. I've tried editing AndroidManifest.xml and removing the duplicate lines, but when I attempt the build they just come back. Is it possible to use these plugins alongside each other?

Thanks for any help.

Edit:

I've also tried removing the line:

<uses-feature android:name="android.hardware.camera" android:required="true"/> from plugins/phonegap-plugin-barcodescanner/plugin.xml

and

<uses-feature android:name="android.hardware.camera" /> from plugins/cordova-plugin-camera-preview/plugin.xml

but this didn't help.

Upvotes: 1

Views: 976

Answers (1)

Daniel Hutton
Daniel Hutton

Reputation: 1455

I removed the line:

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

plugins/cordova-plugin-camera-preview/plugin.xml

This still didn't work, until I ran:

  1. ionic cordova platform rm android

  2. ionic cordova platform add android

  3. ionic cordova build android

Probably not the best solution, but it's working!

Upvotes: 1

Related Questions