ionic4打包android出现的一个问题 2019-04-14

报错信息如下:

> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE

> Task :app:processDebugManifest FAILED

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

22 actionable tasks: 4 executed, 18 up-to-date

D:\workspace\ionic\1\ors\ors\platforms\android\gradlew: Command failed with exit code 1 Error output:

D:\workspace\ionic\1\ors\ors\platforms\android\app\src\main\AndroidManifest.xml:29:5-84 Error:

        Element uses-feature#android.hardware.camera at AndroidManifest.xml:29:5-84 duplicated with element declared at AndroidManifest.xml:27:5-85

D:\workspace\ionic\1\ors\ors\platforms\android\app\src\main\AndroidManifest.xml:31:5-65 Error:

        Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:31:5-65 duplicated with element declared at AndroidManifest.xml:26:5-90

D:\workspace\ionic\1\ors\ors\platforms\android\app\src\main\AndroidManifest.xml Error:

        Validation failed, exiting

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app: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. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

打开 ./platform/android/app/src/AndroidManiFest.xml

可以看到有两个权限申请重复了(粗斜体);

   

   

   

       

           

               

               

           

       

       

           

       

       

       

           

       

       

   

   

   

   

   

   

   

   

   

   

   

   

但是这直接在这里删除重新build或者runandroid并不生效。因为这个问题是在加入Camera Preview后产生的,

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

  cordova-plugin-camera-preview

  Cordova plugin that allows camera interaction from HTML code. Show camera preview popup on top of the HTML.

  Apache 2.0

  cordova,phonegap,ecosystem:cordova,cordova-android,cordova-ios,android,ios,ionic,camera,cam,camera-preview,preview

  https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git

  https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview/issues

 

   

 

 

   

   

   

   

   

   

   

   

   

   

     

       

       

     

   

   

     

     

     

   

   

     

   

 

 

   

     

       

     

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

 

删除两行粗斜体。ionic3可以直接ionic cordova build|android android  问题就解决了,

ionic4 需要ionic cordova platform remove android -> ionic cordova platform add android 

然后ionic cordova build|android android ;

转载请标明出处。

你可能感兴趣的:(ionic4打包android出现的一个问题 2019-04-14)