元素 uses-permission#android.permission.CAMERA 与在 AndroidManifest.xml 处声明的元素重复
Element uses-permission#android.permission.CAMERA duplicated with element declared at AndroidManifest.xml
问题标题是我在为 Android 部署 Ionic 应用程序时收到的错误。我认为(但不确定)这是因为我在我的应用程序中同时使用了 barcodeScanner
和 Camera
插件,它们都需要相机许可。使用两个需要相同权限的插件时,我应该做些什么?另外,是否建议编辑 AndroidManifest
文件,如果是,我应该怎么做?
编辑:
实际上,问题不是因为我在我的应用程序中使用了 barcodeScanner
和 Camera
插件。这是由于我的插件中存在 barcodeScanner
和 qrScanner
引起的(尽管我在我的应用程序中只使用了 barcodeScanner
。尽管接受的答案消除了错误,但我发现它值得指出发现删除其中一个插件也是如此:
cordova plugin remove cordova-plugin-qrscanner
从错误消息中可以清楚地看出,两个元素(即插件)正在使用相同的权限。要解决此类问题,您可以执行以下操作:
在...\plugins\phonegap-plugin-barcodescanner\plugin.xml
中注释out/removeuses-permission
和uses-feature
行
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera">
rm platform android
add platform android
ionic cordova run android
无需触摸 AndroidManifest.xml
文件,也不建议这样做。
希望这会有所帮助。
问题标题是我在为 Android 部署 Ionic 应用程序时收到的错误。我认为(但不确定)这是因为我在我的应用程序中同时使用了 barcodeScanner
和 Camera
插件,它们都需要相机许可。使用两个需要相同权限的插件时,我应该做些什么?另外,是否建议编辑 AndroidManifest
文件,如果是,我应该怎么做?
编辑:
实际上,问题不是因为我在我的应用程序中使用了 barcodeScanner
和 Camera
插件。这是由于我的插件中存在 barcodeScanner
和 qrScanner
引起的(尽管我在我的应用程序中只使用了 barcodeScanner
。尽管接受的答案消除了错误,但我发现它值得指出发现删除其中一个插件也是如此:
cordova plugin remove cordova-plugin-qrscanner
从错误消息中可以清楚地看出,两个元素(即插件)正在使用相同的权限。要解决此类问题,您可以执行以下操作:
在...\plugins\phonegap-plugin-barcodescanner\plugin.xml
中注释out/removeuses-permission
和uses-feature
行<uses-permission android:name="android.permission.CAMERA"/> <uses-feature android:name="android.hardware.camera">
rm platform android
add platform android
ionic cordova run android
无需触摸 AndroidManifest.xml
文件,也不建议这样做。
希望这会有所帮助。