离子原生相机插件冲突

时间:2017-10-17 10:03:11

标签: android cordova ionic-framework ionic2 cordova-plugins

我已安装插件cordova-plugin-camera-preview link。安装完成后,如果我运行ionic cordova build android,应用程序构建正常。

但是,我还需要使用插件phonegap-plugin-barcodescanner link,所以我也安装了它。现在,当我尝试运行ionic cordova build android时,构建失败并出现以下错误:

    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

如果我再次删除其中一个插件,它构建正常。我已经尝试编辑AndroidManifest.xml并删除重复的行,但是当我尝试构建它们时它们才会回来。是否可以将这些插件并排使用?

感谢您的帮助。

编辑:

我也尝试删除该行:

来自<uses-feature android:name="android.hardware.camera" android:required="true"/>

plugins/phonegap-plugin-barcodescanner/plugin.xml

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

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

但这没有帮助。

1 个答案:

答案 0 :(得分:0)

我删除了该行:

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

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

在我跑完之前,这仍然无效:

  1. ionic cordova platform rm android

  2. ionic cordova platform add android

  3. ionic cordova build android

  4. 可能不是最好的解决方案,但它正在发挥作用!