Execution failed for task ':CordovaLib:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt

折月煮酒 提交于 2019-12-29 08:44:05

问题


I am learning how to use Ionic by doing a test application but I have had this problem for two days. I have looked for possible solutions but none has worked for me.

The problem arises when I want to test my application on my android phone. When using this command ionic cordova run android and gives me the following error

FAILURE: Build failed with an exception.

What went wrong:

Execution failed for task ':CordovaLib:processDebugResources'. com.android.ide.common.process.ProcessException: Failed to execute aapt

[ERROR] An error occurred while running cordova run android (exit code 1).

I'm not sure what's wrong. My application it's very simple it's based on Ionic's template ionic start myApp tabs and I'm using Ionic native plugin Geolocation.

I've running ionic info and returns this

cli packages:
    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0
global packages:
    cordova (Cordova CLI) : 7.1.0
local packages:
    @ionic/app-scripts : 3.1.4
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

I also checked the official Cordova's doc for Android development and my paths for Java and Android are OK.

Also with ionic cordova requirements everything looks to be OK.

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25,android-23
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-4.1\bin\gradle

Thanks for any help.


回答1:


The way i solved this problem is as below:

1) npm uninstall cordova ionic

2) npm install -g cordova@7.0.0 ionic@3.19.0

3) cordova platform rm android

4) cordova platform add android




回答2:


This is due to compat plugin. Remove that plugin if you have older version (less than 1.2.0) and set cordova-android@6.3.0

cordova plugin rm cordova-plugin-compat --force

cordova plugin add cordova-plugin-compat@1.2.0

cordova platform rm android

ionic cordova platform add android@6.3.0

Working at my case. Thanks :)




回答3:


Inside android folder under platforms folder there is a file called project.properties Try replacing + with 27.1.0 in below lines

cordova.system.library.1=com.android.support:support-v4:+
cordova.system.library.2=com.android.support:appcompat-v7:+

Also do the same thing in build.gradle file

"com.android.support:support-v4:+"
"com.android.support:appcompat-v7:+"



回答4:


For us, we just had to downgrade version of android

cordova platform rm android
ionic cordova platform add android@6.3.0


来源:https://stackoverflow.com/questions/47719314/execution-failed-for-task-cordovalibprocessdebugresources-com-android-ide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!