Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Element uses-permission#android.permission.CAMERA duplicated with element declared at AndroidManifest.xml

The question title is the error I receive while deploying my Ionic app for Android. I think (but am not sure) this emanates because I use both the barcodeScanner and Camera plugins in my app, which both require the Camera permission. Is there something I should be doing when using two plugins which require the same permission? Also, is it adviseable to edit the AndroidManifest file, and if yes, how exactly should I do it?

Edit:

Actually, the problem wasn't because I used the barcodeScanner and Camera plugins in my app. It was caused by the existence of barcodeScanner and qrScanner among my plugins (even though I used just barcodeScanner in my app. Even though the accepted answer eliminated the error, I find it worthwhile pointing out that removing one of these plugins did as well:

cordova plugin remove cordova-plugin-qrscanner
like image 926
Cedric Ipkiss Avatar asked Aug 15 '18 06:08

Cedric Ipkiss


Video Answer


1 Answers

As it is very clear from the Error message that two elements i.e. plugins are using same permission. To resolve such issue you can do the following:

  • Comment out/remove the line of uses-permission and uses-feature in ...\plugins\phonegap-plugin-barcodescanner\plugin.xml

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-feature android:name="android.hardware.camera">
    
  • rm platform android

  • add platform android

  • ionic cordova run android

No need to touch AndroidManifest.xml file and also it is not advisable.

Hope this will help.

like image 92
Vikasdeep Singh Avatar answered Sep 21 '22 23:09

Vikasdeep Singh