Unable to run/build android

Unable to run/build android (:CordovaLib:processDebugResources FAILED)

###Execution failed for task ‘:CordovaLib:processDebugResources’.

Hello I’m ionic newbie apologize to my english but I’m about to get mad before a couple of days trying to understand why the build fails.

Every project I tried, also the starter projects like:

ionic start myApp tabs
ionic start myApp menu
ionic start myApp tutorial

works fine I could serve in the browser by:

myApp> ionic serve

but when I try to build/run the project for android platform by:

ionic cordova build android
ionic cordova run android <–target> (Also with the device ID from adb devices)

The build fails and returns the following error:

Running app-scripts build: --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --externa
lIpRequired --nobrowser

[00:49:11] build dev started …
[00:49:11] clean started …
[00:49:11] clean finished in 11 ms
[00:49:11] copy started …
[00:49:11] transpile started …
[00:49:14] transpile finished in 3.17 s
[00:49:14] preprocess started …
[00:49:14] deeplinks started …
[00:49:14] deeplinks finished in 27 ms
[00:49:14] preprocess finished in 29 ms
[00:49:14] webpack started …
[00:49:15] copy finished in 3.43 s
[00:49:24] webpack finished in 9.28 s
[00:49:24] sass started …
[00:49:25] sass finished in 1.10 s
[00:49:25] postprocess started …
[00:49:25] postprocess finished in 12 ms
[00:49:25] lint started …
[00:49:25] build dev finished in 13.70 s

cordova run android --target XXXXXXXXXXX
ANDROID_HOME=C:\Users\Me\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_73

Subproject Path: CordovaLib
[00:49:29] lint finished in 4.00 s
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Ac
tion) instead.
at build_ajuzvi2l53suo4b7l6zvmqd68.run(C:\Users\Marco\Documents\MilizianCompany\testTab\platforms\android\build.gradle
:137)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.f
ile(Object).skipWhenEmpty() instead.
:preBuild
UP-TO-DATE
:preDebugBuild
UP-TO-DATE
:checkDebugManifest

:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild
UP-TO-DATE
:CordovaLib:checkDebugManifest

:CordovaLib:prepareDebugDependencies

:CordovaLib:compileDebugAidl

UP-TO-DATE
:CordovaLib:compileDebugNdk
UP-TO-DATE
:CordovaLib:compileLint

UP-TO-DATE
:CordovaLib:copyDebugLint
UP-TO-DATE

:CordovaLib:mergeDebugShaders
UP-TO-DATE

:CordovaLib:compileDebugShaders

UP-TO-DATE
:CordovaLib:generateDebugAssets
UP-TO-DATE
:CordovaLib:mergeDebugAssets
UP-TO-DATE

:CordovaLib:mergeDebugProguardFiles

UP-TO-DATE
:CordovaLib:packageDebugRenderscript
UP-TO-DATE

:CordovaLib:compileDebugRenderscript
UP-TO-DATE

:CordovaLib:compileDebugRenderscript

:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources

:CordovaLib:processDebugManifest

:CordovaLib:generateDebugBuildConfig
UP-TO-DATE

:CordovaLib:processDebugResources

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

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

BUILD FAILED

Total time: 3.129 secs
Error: cmd: Command failed with exit code 1 Error output:
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

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

I tried all the resolved issues on github, all the solved questions on stackOverFlow.
I dont know why the starter projects returns gradle warnings with obsolete/deprecated tasks and I can’t find out the error.

Working on windows10 with:

  • ionic 3.3.0 (also 3.2.0)
  • cordova 7.0.1
  • npm 3.10.10
  • node v6.10.2

Thanks in advance.

1 Like

hi

try that sequence

ionic build android
ionic run android
ionic build android (if your smartphone is connected by usb)
ionic run -c -l

hope this helps, Francois

Hi francoisIonic thanks for the quick answer.

I cannot execute ionic build or ionic run without cordova (you probably you take it for granted).

I just tried ionic cordova build with the very same result, andionic run -c -l who shows me the ip availables as well as tries to run android on it, but the result was exactly the same.

On the other hand I have discovered Ionic view app for android that allows me to test the app on my android device, but I am concerned because is unable to build a simple starter project.

I will still trying any other ideas.

Hello Marco,

Yes I took if for granted, sorry. This all looks like something is wrong with your node/ionic/cordova local setup.

Still, I put a summary of common issues:

  1. your android sdk is not working well (or not installed on your computer) (this shows a message when using ionic run android)
  2. ionic fails to find your connected android smartphone, again possible reasons, like your smartphone drivers are not setup or correct on windows (you have a message about that is no device found when using ionic run android).
  3. You forgot to add android platform inside your ionic project folder. Aka, while in your project folder, with npm and ionic setup, type:

ionic platform add android

Finally, yes Ionic view is nice, yet it’s not enough and not very practical while coding.
Good luck,

mmmm…

I will look to reinstall or fix my sdk, I was managing (with android studio SDK manager) my API version, usb device tools, delevopers-tools, etc…

My device is connected successfully, and the android platform was added succesfully (at least I think it), and I know now for sure that is my own problem because I’m able to build with other PC.

I will inform of any solution but at the moment I’m trying to dockerize it to make it easier.

Thanks again for your help.

You’re welcome @marcocab, sorry was not able to debug this. As you took the time to debug it yourself, yeah it seems the issue is only local, related to your ionic/angular/node bundle. Try to reinstall everything with a fresh start, i know it’s a pain but :frowning:

Before that, I suggest you give another try with a fresh project, like the quickstarter guide here:

1) npm install -g cordova ionic

2) ionic start myApp tabs

3) cd myApp
ionic serve

I just did.
I’ve uninstalled the whole Android Studio, and then reinstall all (sdk, sdk tools included), and I upload my jdk:

ANDROID_HOME=C:\Users\Marco\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131

Then I’ve updated cordova and ionic version (I’ve been working all the year with angular4, npm, node, Spring, etc without problems):

PS C:\Users\Marco\Documents\myApp> cordova -v
7.0.1
PS C:\Users\Marco\Documents\myApp> npm install -g cordova@latest
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
C:\Users\Marco\AppData\Roaming\npm\cordova -> C:\Users\Marco\AppData\Roaming\npm\node_modules\cordova\bin\cordova
removed 1 package and updated 400 packages in 113.483s
PS C:\Users\Marco\Documents\myApp> cordova -version
7.0.1
PS C:\Users\Marco\Documents\myApp> npm install -g ionic@latest
C:\Users\Marco\AppData\Roaming\npm\ionic -> C:\Users\Marco\AppData\Roaming\npm\node_modules\ionic\bin\ionic
removed 1 package and updated 122 packages in 30.361s
PS C:\Users\Marco\Documents\myApp> ionic -v
3.3.0
PS C:\Users\Marco\Documents\myApp> npm -v
5.0.1
PS C:\Users\Marco\Documents\myApp> node -v
v6.10.2

Then I did the cycle again:

  1. npm install -g cordova ionic (update ionic and cordova to the same version I had)
  1. ionic start myApp tabs
  1. cd myApp
  2. ionic serve -lab (works fine)
  3. ionic cordova build android
    (> cordova platform add --save android
    :heavy_check_mark: Running command - done!**)

But I dont know why… same error

 cordova build android
- Running command [02:43:32]  lint finished in 4.17 s
✖ Running command - failed!

        [ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

    [ERROR] An error occurred while running cordova build android (exit code 1):

        ANDROID_HOME=C:\Users\Marco\AppData\Local\Android\sdk
        JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
        :wrapper

        BUILD SUCCESSFUL

        Total time: 2.635 secs
        Subproject Path: CordovaLib
        The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast
(Action) instead.
                at build_mk0sohl7vbr87h23viuw0fwn.run(C:\Users\Marco\Documents\MilizianCompany\myApp\platforms\android\build.gradle
:137)
        The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
        Incremental java compilation is an incubating feature.
        The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInput
s.file(Object).skipWhenEmpty() instead.
        :preBuild UP-TO-DATE
        :preDebugBuild UP-TO-DATE
        :checkDebugManifest
        :CordovaLib:preBuild UP-TO-DATE
        :CordovaLib:preDebugBuild UP-TO-DATE
        :CordovaLib:checkDebugManifest
        :CordovaLib:prepareDebugDependencies
        :CordovaLib:compileDebugAidl
        :CordovaLib:compileDebugNdk UP-TO-DATE
        :CordovaLib:compileLint
        :CordovaLib:copyDebugLint UP-TO-DATE
        :CordovaLib:mergeDebugShaders
        :CordovaLib:compileDebugShaders
        :CordovaLib:generateDebugAssets
        :CordovaLib:mergeDebugAssets
        :CordovaLib:mergeDebugProguardFiles
        :CordovaLib:packageDebugRenderscript UP-TO-DATE
        :CordovaLib:compileDebugRenderscript
        :CordovaLib:generateDebugResValues
        :CordovaLib:generateDebugResources
        :CordovaLib:packageDebugResources
        :CordovaLib:processDebugManifest
        :CordovaLib:generateDebugBuildConfig
        :CordovaLib:processDebugResources FAILED

        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

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

        BUILD FAILED

        Total time: 5.3 secs
        Error: cmd: Command failed with exit code 1 Error output:
        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

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

Now I’m more annoying.

1 Like

Can you tell me / us what linux build are your runnning? It looks like you build something with a linux package that miss something?

(yeah i know some linux, i have linux vps servers on ubuntu, digital ocean, rhel cloud too).

Good luck,

I’ve created a CI cycle with docker, travisCI and GitHub and now I’m able to still with all the process.

With my own system:

  • Windows 10 - 64bits

Hello sir,

Did you find any solution to this problem. I am also facing same problem.

Hello Marco,

Could you explain your solution?
I’ve got the same exact error.

I’m facing the same issue, the weird thing is this problem is coming only when there is a proxy server configured for the PC, else, when connecting to direct internet using wifi for example and disable the proxy the command woks fine and the application run on the connected device.
I don’t know if this making any sense or not

Dammit facing the same issue
Did someone find the solution?

Hello to everybody, i have the same problem, i have do like marcocab did but i dont arrived so who are here to help me please, thanks