Cordova Android 从两个插件中复制了使用功能 [英] Cordova Android duplicated uses-feature from two plugins
问题描述
我在cordova中使用了两个不同的插件,它们都具有相同的uses-feature
,一个带有android:required="false"
,一个没有.>
这会导致构建错误:
processDebugManifest/path/to/project/platforms/android/AndroidManifest.xml:31:5 错误:元素在 AndroidManifest.xml:31:5 中使用-feature#android.hardware.camera 与在 AndroidManifest.xml:27:5 中声明的元素重复/path/to/project/platforms/android/AndroidManifest.xml:32:5 错误:元素在 AndroidManifest.xml:32:5 处使用-feature#android.hardware.camera.autofocus 与在 AndroidManifest.xml:28:5 处声明的元素重复/path/to/project/platforms/android/AndroidManifest.xml:0:0 错误:验证失败,退出:processDebugManifest 失败.....错误构建平台之一:错误:/path/to/project/platforms/android/cordova/build:命令失败,退出代码为 1您可能没有构建此项目所需的环境或操作系统
编译后的清单在构建时具有以下内容:
<代码>...<uses-feature android:name="android.hardware.camera" android:required="false"/><uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/><uses-feature android:name="android.hardware.camera.flash" android:required="false"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-feature android:name="android.hardware.camera"/><uses-feature android:name="android.hardware.camera.autofocus"/>...
我能做些什么来解决这个问题吗?
<小时>科尔多瓦 5.4.1 版
我在使用cordova-plugin-camera 和phonegap-plugin-barcodescanner 时遇到了理智的问题.我的修复:
ionic cordova 平台 rm android离子cordova平台rm ios离子cordova插件rm phonegap-plugin-barcodescannerrm -r 插件rm -r node_modulesrm 包-lock.json
接下来删除package.json的phonegap-plugin-barcodescanner.运行:
npm 安装离子cordova平台添加android
接下来做一个新的构建:
ionic cordova 运行 android
接下来再次添加插件:
ionic cordova plugin add phonegap-plugin-barcodescanner
I am using two different plugins into cordova, which both have the same uses-feature
, one with android:required="false"
and one without.
This results in an error upon build:
processDebugManifest
/path/to/project/platforms/android/AndroidManifest.xml:31:5 Error:
Element uses-feature#android.hardware.camera at AndroidManifest.xml:31:5 duplicated with element declared at AndroidManifest.xml:27:5
/path/to/project/platforms/android/AndroidManifest.xml:32:5 Error:
Element uses-feature#android.hardware.camera.autofocus at AndroidManifest.xml:32:5 duplicated with element declared at AndroidManifest.xml:28:5
/path/to/project/platforms/android/AndroidManifest.xml:0:0 Error:
Validation failed, exiting
:processDebugManifest FAILED
.....
ERROR building one of the platforms: Error: /path/to/project/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
The compiled manifest has the following when built:
...
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
...
Is there anything I can do to fix this?
cordova version 5.4.1
I had the sane issue with cordova-plugin-camera and phonegap-plugin-barcodescanner. My fix:
ionic cordova platform rm android
ionic cordova platform rm ios
ionic cordova plugin rm phonegap-plugin-barcodescanner
rm -r plugins
rm -r node_modules
rm package-lock.json
Next remove the phonegap-plugin-barcodescanner of the package.json. Run:
npm install
ionic cordova platform add android
Next do a new build:
ionic cordova run android
Next add the plugin again:
ionic cordova plugin add phonegap-plugin-barcodescanner
这篇关于Cordova Android 从两个插件中复制了使用功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!