简体   繁体   中英

Cordova add platform android error

Creating android project... Error:

C:\\Users\\user1.cordova\\lib\\npm_cache\\cordova-android\\3.6.4\\package\\bin\\create.bat: Command failed with exit code ENOENT at ChildProcess.whenDone (C:\\Users\\user1\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\cordova-lib\\src\\cordova\\superspawn.js:135:23) at ChildProcess.emit (events.js:95:17) at Process.ChildProcess._handle.onexit (child_process.js:807:12)

The Path environment variable is set as : C:\\ProgramData\\Oracle\\Java\\javapath;%SystemRoot%;%SystemRoot%\\system32;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;D:\\Program Files\\TortoiseSVN\\bin;%JAVA_HOME%\\bin;%ANDROID_HOME%\\tools;%ANDROID_HOME%\\platform-tools;%ANT_HOME%\\bin;C:\\Program Files\\nodejs\\

where JAVA_HOME is :C:\\Program Files\\Java\\jdk1.8.0_25 ANDROID_HOME is : D:\\Softwares\\AndroidSDK\\sdk\\sdk ANDROID_SWT is: D:\\Softwares\\AndroidSDK\\sdk\\sdk\\tools\\lib\\x86_64 ANT_HOME: C:\\Program Files\\apache-ant-1.9.4

I have tried with installing jdk 7 and 6 but still same error.. Can any one please help..

Finally the issue is resolved.. My ComSpec environment variable whose value is %SystemRoot%\\system32\\cmd.exe had a ";" at the end, which was causing this issue. I just removed ";" and yuppie.. it worked..

What actually happened here is that cmd command can not be found.

I got the same problem today on Windows 7, NodeJS 5.4, Cordova 5.4.1. cordova platform add android failed to work because of unknown issue. However, cordova -d platform add android actually showed some clues. cordova platform add android is a wrapper over the real command: cmd /s /c "..../create.bat" ... . When you executed that command manually, you would know the underlying error: 'cmd' is not recognized as an internal or external command .

I have to change ComSpec environment variable from %SystemRoot%\\system32\\cmd.exe to %SystemRoot%\\system32\\cmd.exe;%SystemRoot%\\system32 to make it work.

If it does not work, please add %SystemRoot%\\system32 intp PATH as well

You've entered the wrong command . Try this

cordova platform add android

fix is here (FOR WINDOWS ONLY)

I am facing the same problem of Build then i finally found out the solution.

SOLUTION
So You must have the Android Api 23 in order for this command to work.
Error of Daemon process will be solve after installing the Api 23 and extra
build tools and run command
COMMAND : cordova build android --release
I am sure this fix would help you to solve the problem.

STEPS
1. First check the version of android through this COMMAND: cordova platform help
2. Run the build command after installing the Api 23 and extra build tools.
3. If Even this not work then Try add the variable in the
Environment variables > System variables >
add _JAVA_OPTIONS and value = -Xmx512M

Then Run cordova build android --release

BUT FIRSTLY SET UP THE ENVIRONMENT VARIABLES
Environment Variable setup Image
android API 23

COPY FROM HERE
ENVIRONMENT VARIABLES:-

  1. USER VARIABLES
    PATH
    C:\\Ruby23\\bin;C:\\Users\\kumar\\AppData\\Roaming\\npm;C:\\ANDROID_SDK\\tools;%SystemRo ot%\\system32; %SystemRoot%; %SystemRoot%\\System32\\Wbem;

  2. SYSTEM VARIABLES
    ADD NAME AND VALUE
    2.1 _JAVA_OPTIONS -Xmx512M
    2.2 ANDROID_HOME C:\\ANDROID_SDK
    2.3 PATH ->
    C:\\ProgramFiles\\Java\\jdk1.8.0_60\\bin;C:\\ProgramFiles\\nodejs;C:\\Gradle\\gradle-4.0\\bin;C:\\ANDROID_SDK\\tools;%SystemRoot%\\system32; %SystemRoot%; %SystemRoot%\\System32\\Wbem;%SystemRoot%\\system32; %SystemRoot%; %SystemRoot%\\System32\\Wbem;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM