无法使用离子项目创建apk

时间:2017-07-14 20:26:08

标签: android ionic-framework apk

嗨我是新的离子和我试图创建一个apk来测试我的qr扫描仪项目,但当我运行命令离子cordova构建android --release 我得到以下错误输出:

有关清单合并的详细信息,请参阅http://g.co/androidstudio/manifest-merger

Future<Double> future = completionService.take();
try {
    System.out.printf("The square root of %d is %f%n", tasks.get(future), future.get());
}
catch (ExecutionException e) {
    if(e.getCause() != null && e.getCause() instanceof InvalidIntegerException) {
        Integer n = ((InvalidIntegerException) e.getCause()).getInteger();
        System.err.println("Failure to calculate the square root of: " + n);
    }

有人可以帮忙解决这个问题吗?

输出:

    :processReleaseManifest FAILED

    BUILD FAILED

    Total time: 13.446 secs
    C:\Users\delacrga\Ionic projects\myApp\platforms\android\AndroidManifest.xml:19:5-65 Error:
    Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:19:5-65 duplicated with element
    declared at AndroidManifest.xml:16:5-90
    C:\Users\delacrga\Ionic projects\myApp\platforms\android\AndroidManifest.xml:21:5-84 Error:
    Element uses-feature#android.hardware.camera at AndroidManifest.xml:21:5-84 duplicated with element declared at
    AndroidManifest.xml:17:5-85
    C:\Users\delacrga\Ionic projects\myApp\platforms\android\AndroidManifest.xml Error:
    Validation failed, exiting

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':processReleaseManifest'.
    > 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.
    Error: cmd: Command failed with exit code 1 Error output:
    C:\Users\delacrga\Ionic projects\myApp\platforms\android\AndroidManifest.xml:19:5-65 Error:
    Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:19:5-65 duplicated with element
    declared at AndroidManifest.xml:16:5-90
    C:\Users\delacrga\Ionic projects\myApp\platforms\android\AndroidManifest.xml:21:5-84 Error:
    Element uses-feature#android.hardware.camera at AndroidManifest.xml:21:5-84 duplicated with element declared at
    AndroidManifest.xml:17:5-85
    C:\Users\delacrga\Ionic projects\myApp\platforms\android\AndroidManifest.xml Error:
    Validation failed, exiting

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':processReleaseManifest'.
    > 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.

2 个答案:

答案 0 :(得分:0)

如果您安装了两个不同的插件,请求相机的权限,即cordova-plugin-qrscanner和phonegap-plugin-barcodescanner,这将导致此问题。

通过

删除任一插件
ionic cordova plugin remove phonegap-plugin-barcodescanner

ionic cordova plugin remove cordova-plugin-qrscanner

答案 1 :(得分:0)

是的。@杰伊是正确的。因为我的离子项目安装了两个不同的插件,所以需要相机的许可。 cordova-plugin-qrscanner和cordova-plugin-cszbar,删除其中一个插件即可正常工作。