Release build fails with exit code ENOENT in Visual Studio Tools for Apache Cordova

137 views Asked by At

I am trying to build an app with Apache Cordova using Visual Studio Tools for Apache Cordova. The app builds and runs successfully when I run it in a browser simulator in Debug mode but fails with following error when I try to run it on Release mode.

Error: cmd: Command failed with exit code ENOENT

I went though the logs and found the following

Reading the keystore from: d:\infocraft.keystore
Running command: cmd "/s /c 
"C:\Users\SOL_Lenovo_IT_2\source\repos\TestApp\TestApp\
platforms\android\gradlew.bat cdvBuildRelease -b 
C:\Users\SOL_Lenovo_IT_2\source\repos\TestApp\TestApp\
platforms\android\build.gradle -Dorg.gradle.daemon=true - 
Pandroid.useDeprecatedNdk=true""
Command finished with error code ENOENT: cmd /s /c 
"C:\Users\SOL_Lenovo_IT_2\source\repos\TestApp\
TestApp\platforms\android\gradlew.bat cdvBuildRelease -b 
C:\Users\SOL_Lenovo_IT_2\source\repos\TestApp\
TestApp\platforms\android\build.gradle -Dorg.gradle.daemon=true - 
Pandroid.useDeprecatedNdk=true"
1>MSBUILD : cordova-build error : Error: cmd: Command failed with exit code 
ENOENT
1>Done building project "TestApp.jsproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Following are the advised solutions that I have tried.

  1. Clearing Cordova Cache
  2. Adding Windows/System32 in System Environment Variable.
  3. Reinstalling Visual Studio , JDK

My machine satisfies all the system requirements and I have gone through all the suggested solutions on the site but nothing worked for me

1

There are 1 answers

0
psyborg.eth On BEST ANSWER

For the above issue there are 4 possible solutions

  1. Clear Cordova Cache
  2. Add Windows/System32 in System Environment Variable.
  3. Reinstall Visual Studio
  4. compatibility issues between the Version of JDK installed on my machine and Gradle

In my case the issue was arising due to compatibility issues between the Version of JDK installed on my machine and Gradle. The latest version of Gradle works fine with Java 1.8.x.xx.