简体   繁体   中英

Apache cordova add platform android error

I try the command >cordova platform add android

and here's what I get:

C:\Users\Daniel\Workspaces\cordova\hello>cordova platform add android
Creating android project...

C:\Users\Daniel\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_mo
dules\q\q.js:126
                    throw e;
                          ^
Error: Failed to run "android". Make sure you have the latest Android SDK instal
led, and that the "android" command (inside the tools/ folder) is added to your
PATH.
    at C:\Users\Daniel\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\
lib\check_reqs.js:43:27
    at exithandler (child_process.js:644:7)
    at ChildProcess.errorhandler (child_process.js:660:5)
    at ChildProcess.emit (events.js:95:17)
    at Process.ChildProcess._handle.onexit (child_process.js:808:12)
Error: C:\Users\Daniel\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\
create.bat: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\Daniel\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

As far as I can tell, my Path is set right.

ANDROID_HOME  C:\Development\adt-bundle\sdk\

Path %ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;etc

Previously I had my path set explicitly with the same error ( Path C:\\Development\\adt-bundle\\sdk\\platform-tools;etc ). I've tried several different combinations to try to get it to work, but I always get the same error. My Android SDK is up do date. What am I missing?

So, it turns out that when I updated the Path, I erased the default values in there. For windows 7 it was

%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\

Then append to the end of that. Doing this gave me a new error:

Error: Please install Android target "android-19"

From here it was clear to me what to do, but if anyone else runs across this, here is a solution to the second error: Cordova 3.5.0 Install Error- Please Install Android Target 19

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