Ionic原生相机插件冲突



我已经安装了插件cordova-plugin-camera-preview链接。安装后,如果我运行ionic cordova build android,应用程序构建良好。

然而,我还需要使用插件phonegap-plugin-barcodescanner链接,所以我也安装了这个。现在,当我尝试运行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并删除重复的行,但当我尝试构建时,它们只是回来了。这些插件可以同时使用吗?

谢谢你的帮助。

编辑:

我还试着删除了这条线:

plugins/phonegap-plugin-barcodescanner/plugin.xml中的<uses-feature android:name="android.hardware.camera" android:required="true"/>

plugins/cordova-plugin-camera-preview/plugin.xml中的<uses-feature android:name="android.hardware.camera" />

但这无济于事。

我删除了行:

<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

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

最新更新