Cordova Cannot Add Android Failed with Exit Code Enoent

Cordova Build Android failed with exit code ENOENT

You can update android sdk through command line:

Go to folder android-sdk\tools\bin and run the command:

List installed and available packages

sdkmanager --list

Install packages

sdkmanager packages [options]

For example, to get adb and fastboot, install the latest platform tools:

sdkmanager "platforms;android-25"

Usage:

  sdkmanager --update [<common args>]
sdkmanager --list [<common args>]
sdkmanager [--uninstall] [<common args>] \
[--package_file <package-file>] [<packages>...]

In its first form, installs, or uninstalls, or updates packages.
<package> is a sdk-style path (e.g. "build-tools;23.0.0" or
"platforms;android-23").
<package-file> is a text file where each line is a sdk-style path
of a package to install or uninstall.
Multiple --package_file arguments may be specified in combination
with explicit paths.
In its second form (with --update), currently installed packages are
updated to the latest version.
In its third form, all installed and available packages are printed out.

Reference: https://developer.android.com/studio/command-line/sdkmanager.html

ionic platform add android Command failed with exit code ENOENT

try running to yield more debug information.

ionic -d platform add android

In my case, I added c:\windows\system32 to the PATH environment variable and it fixed the problem.

android target: android: command failed with exit code enoent Meteor

Try run your this command in your terminal:

echo $ANDROID_HOME

it should return something like this

/home/ivan133/Android/Sdk

If it returns empty string execute these commands and build again

export ANDROID_HOME=${HOME}/Android/Sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

Next, it would be nice to add it to your ./bashrc (if you're using bash)
Just open ~/.bashrc with text editor and copy the strings to the end

ionic platform error when adding android platform

If you are in Windows usually this kind of error happens when you don't have all the paths required in your system environment path variable . Especially the path variables given bellow.

Please paste this line on your system environment Path variable:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Windows\System32;

You can also check this out. There is the total installation tutorial.

Error: ENOENT: no such file or directory when running Ionic Cordova Platform Add Android

I was running with the same error and today I found out the solution.
In the past, I tried a capacitor plugin, but my project is cordova, so I removed it from my project. But I think that some files were not properly deleted and when I ran ionic repair, the problem started.
So, to repair this I deleted the ANDROID folder at project root, any files related to Capacitor at root, edited the package.json and removed everything related with Capacitor and everything works again.

Solution

  1. Delete the android folder at project root
  2. Edit the package.json and remove everything related with Capacitor


Related Topics



Leave a reply



Submit