简体   繁体   English

离子中的 Android 构建错误 - 包括 Cordova 插件文件

[英]Android build error in ionic - on including Cordova plugin file

The below error appears to be when it to use cordova plugin 'file' & 'file-opener2' in my project.以下错误似乎是在我的项目中使用cordova插件'file'和'file-opener2'时。 On removing the plugin , it generates a proper android build.在删除插件时,它会生成一个正确的 android 版本。

I also tried to set cordova version to 7.1.0 and cordova platform android to version 6.4.0.我还尝试将cordova 版本设置为7.1.0,将cordova 平台android 设置为6.4.0 版。 Though the error differs, the build still fails尽管错误不同,但构建仍然失败

* Wh
at went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

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

BUILD FAILED in 2s
    at ChildProcess.whenDone (/Users/Naresh/Documents/AnshFertilityApp/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at ChildProcess.emit (events.js:180:13)
    at maybeClose (internal/child_process.js:936:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:99591) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:99591) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My current ionic info :我目前的离子信息:

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v9.8.0
    npm  : 5.6.0 
    OS   : macOS High Sierra

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

I installed this plugin and it worked fine:我安装了这个插件,效果很好:

https://github.com/dpa99c/cordova-android-support-gradle-release https://github.com/dpa99c/cordova-android-support-gradle-release

Replace代替

<framework src="com.android.support:support-v4:+" />

to

<framework src="com.android.support:support-v4:24.1.1+" />

in plugin.xml of cordova.plugins.fileOpener2 .cordova.plugins.fileOpener2 plugin.xml中。 and remove android platform ionic cordova platform rm android and then add again ionic cordova platform add android并删除 android platform ionic cordova platform rm android 然后再次添加 ionic cordova platform add android

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM