Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
412 views
in Technique[技术] by (71.8m points)

ios - An error occurred while listing Android targets

I am getting this same error while trying to add platform Android to simple HelloWorld application created using CLI Cordova on Windows 8.

Path vaiables has been set for %ANT%,%ANT_HOME%,%ANDROID_HOME%
PATH Also contains %ANDROID_HOME%platform-tools and %ANDROID_HOME%ools in the listings.

PS E:Android ProjectsHelloWorld> cordova platforms add android
Creating android project...

C:UsersMIGHTY.cordovalibandroidcordova3.4.0in
ode_modulesqq.js:126
                throw e;
                      ^
Error: An error occurred while listing Android targets
    at C:UsersMIGHTY.cordovalibandroidcordova3.4.0inlibcheck_reqs.js:87:29
    at _rejected       (C:UsersMIGHTY.cordovalibandroidcordova3.4.0in
ode_modulesqq.js:808:24)
at C:UsersMIGHTY.cordovalibandroidcordova3.4.0in
ode_modulesqq.js:834:30
at Promise.when (C:UsersMIGHTY.cordovalibandroidcordova3.4.0in
ode_modulesqq.js:1079:31)
at Promise.promise.promiseDispatch (C:UsersMIGHTY.cordovalibandroidcordova3.4.0in
ode_modulesqq.js:752:41)
at C:UsersMIGHTY.cordovalibandroidcordova3.4.0in
ode_modulesqq.js:574:44
at flush (C:UsersMIGHTY.cordovalibandroidcordova3.4.0in
ode_modulesqq.js:108:17)
at process._tickCallback (node.js:415:13)
Error: C:UsersMIGHTY.cordovalibandroidcordova3.4.0increate.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:UsersMIGHTYAppDataRoaming
pm
ode_modulescordovasrcsuperspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)

Simillar error is being raised while trying to create the same on iOS also.

PS E:Android ProjectsHelloWorld> cordova platforms add ios
Creating ios project...
Error: C:UsersMIGHTY.cordovalibioscordova3.4.1increate: Command failed with       exit code ENOENT
at ChildProcess.whenDone (C:UsersMIGHTYAppDataRoaming
pm
ode_modulescordovasrcsuperspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:795:12)

Solved:

Thank you, the issue with Android has been resolved.

The path variable pointing to this android was wrong. I had used %ANDROID_HOME% as variable and scaled the same to path variables %ANDROID_HOME%SDKTOOLS. This method doesn't work. Experimentally resolved by directly pointing to the Tools and Platform Tools.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can't add the iOs platform on Windows 8 (Check the available commands on the link):

"Your ability to run these commands depends on whether your machine supports each SDK, and whether you have already installed each SDK."

source: http://cordova.apache.org/docs/en/3.4.0//guide_cli_index.md.html#The%20Command-Line%20Interface


Android is strange though.. Can you provide any more details? (are all the environment variables set correctly? did you add JAVA_HOME?..)

Hopefully I'll be more of a help with some more info :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...