Execution failed for task ':CordovaLib:processDebugResources'. - New Ionic Project

I get below error for new Ionic Project, I am unable to do the build, so I cant test on my phone, or emulator, or create APK. there is no error in the code, its a fresh project.

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


        ANDROID_HOME=C:\Users\username\AppData\Local\Android\Sdk
        JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
        :wrapper

        BUILD SUCCESSFUL in 1s
        1 actionable task: 1 executed
        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_agprj4r3f53ndc1g298x4j1sy.run(C:\Users\murli\IonicProjects\toDo\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.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: 6.58 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 guess the issue is with my setup or something. it cant be ionic issue.

Environment Variables

3

SDK Platforms

1

SDK TOOLS

UPDATE

cli packages: (C:\Users\murli\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 3.1.0
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v6.10.1
    npm  : 5.4.2
    OS   : Windows 10

Misc:

    backend : pro

What is your ionic info output?

please check, I have updated my question

I just tried to build the project in my friends computer and it works fine, but not on my laptop for some reason. What could be the reason? any debugging steps? I created entire ionic project and installed Android Studio, installed API level 25 as per ionic requirement and now trying to build after adding android platform. The issue is from my laptop side. what could it be?

Old, should be updated.

Strange, here something should be listed.

What does ionic cordova platform list return?
What does ionic cordova requirements return?

I upgraded my Ionic CLI to 3.19.0

ionic cordova platform list : returned

nothing

ionic cordova requirements : returned

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

The batch file cannot be found.

Then you should not be able to build for Android.

What command are you using to do so?

This is what it returned. I guess it showed nothing because CLI was updating:

> cordova platform ls
Installed platforms:
  android 6.2.3
Available platforms:
  blackberry10 ~3.8.0 (deprecated)
  browser ~4.1.0
  webos ~3.7.0
  windows ~5.0.0

Does ionic info now return that as well?

Current version is 6.4.0 - you should upgrade to that.

Yes, ionic info returns that aswell:

λ ionic info

cli packages: (C:\Users\murli\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.7.1

System:

    Android SDK Tools : 26.1.1
    Node              : v6.10.1
    npm               : 5.4.2
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Users\murli\AppData\Local\Android\Sdk

Misc:

    backend : pro

How to upgrade to 6.4.0? is this my phone or what 6.2.3? because its everywhere shown

New Issue after upgrading to 6.4.0

Execution failed for task ‘:mergeDebugResources’.

Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.

For documentation and future readers:

ionic cordova platform remove android
ionic cordova platform add android@6.4.0

Post your current ionic info again and more important the complete error message.

You wont believe I removed
Android studio using control panel,
Android folder from Program Files.

I even removed
.Android,
.Android Studio3.0, and entire Android Folder from
AppData/Local/

And Reinstalled Android Studio but I still get this error :confused:
Ionic Info returns :

λ ionic info

cli packages: (C:\Users\murli\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 3.1.0
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v6.10.1
    npm               : 5.4.2
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Users\murli\AppData\Local\Android\Sdk

Misc:

    backend : pro

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_b13xbct8k6dks57ag9p1t9wwa.run(C:\Users\murli\IonicProjects\Savings\platforms\android\build.gradle:141)
Configuration ‘compile’ in project ‘:’ is deprecated. Use ‘implementation’ instead.
File C:\Users\murli.android\repositories.cfg could not be loaded.
Checking the license for package Android SDK Platform 26 in C:\Users\murli\AppData\Local\Android\Sdk\licenses
License for package Android SDK Platform 26 accepted.
Preparing “Install Android SDK Platform 26 (revision: 2)”.

“Install Android SDK Platform 26 (revision: 2)” ready.
Installing Android SDK Platform 26 in C:\Users\murli\AppData\Local\Android\Sdk\platforms\android-26
“Install Android SDK Platform 26 (revision: 2)” complete.
“Install Android SDK Platform 26 (revision: 2)” finished.
Download https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom
Download https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar

publishNonDefault is deprecated and has no effect anymore. All variants are now published.
:preBuild UP-TO-DATE
:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
UP-TO-DATE
:CordovaLib:processDebugManifest
UP-TO-DATE
:preDebugBuild

:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl
UP-TO-DATE
:compileDebugAidl
UP-TO-DATE
:CordovaLib:packageDebugRenderscript
NO-SOURCE

:compileDebugRenderscript
UP-TO-DATE
:checkDebugManifest UP-TO-DATE
:generateDebugBuildConfig
UP-TO-DATE

:prepareLintJar UP-TO-DATE

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

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

Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
:mergeDebugResources FAILED

14 actionable tasks: 1 executed, 13 up-to-date
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:mergeDebugResources’.

Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.

  • 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 11m 49s
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:mergeDebugResources’.

Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.

  • 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 11m 49s

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


ANDROID_HOME=C:\Users\murli\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121

This is not 6.4.0.

Why did you do this? What indicates a problem with Android studio?

I did upgrade to 6.4.0 before removing everything, it gave below error.
I can upgrade it 6.4.0 but then it would give below error. My project is fresh, new and untouched. Why build is having this issue? I cant even print stacktrace using --stacktrace.

Error:java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.

Error:Execution failed for task ':app:mergeDebugResources'.

Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details. Not what sure is causing these errors

I am tired of this now, its been 2 days and no fix.

This is not a very common error message, actually never seen it before.
Googling for it indicates that it has to do with Android Studio 3, most of the questions are from the last few days.

Best way to continue debugging: Install 6.4.0 and run ionic info, post that and the complete error output of running the main command.

Okay, i will do that tomorrow morning and let u know.
Its 4am here.

I had the same issue and fixed it from the PATH of Environment Variables.
I added cmder from the PATH and then the error occurred.
After removing the cmder from PATH, it worked again.
Also, executing comand from cmder occasionally occurs the error. Went back to basic and used cmd.