科尔多瓦Android通过两个插件重复使用功能 [英] Cordova Android duplicated uses-feature from two plugins
问题描述
我在cordova中使用了两个不同的插件,它们都具有相同的uses-feature
,一个带有android:required="false"
,一个没有.
I am using two different plugins into cordova, which both have the same uses-feature
, one with android:required="false"
and one without.
这会导致生成错误:
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版本5.4.1
cordova version 5.4.1
推荐答案
我在cordova-plugin-camera和phonegap-plugin-barcodescanner中遇到了理智的问题.我的解决办法:
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
接下来,删除package.json的phonegap-plugin-barcodescanner. 运行:
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
接下来再次添加插件:
ionic cordova plugin add phonegap-plugin-barcodescanner
这篇关于科尔多瓦Android通过两个插件重复使用功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!