Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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%\tools in the listings.

PS E:\Android Projects\HelloWorld> cordova platforms add android
Creating android project...

C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:126
                throw e;
                      ^
Error: An error occurred while listing Android targets
    at C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:87:29
    at _rejected       (C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:808:24)
at C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:834:30
at Promise.when (C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:752:41)
at C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:574:44
at flush (C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: C:\Users\MIGHTY\.cordova\lib\android\cordova\3.4.0\bin\create.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\MIGHTY\AppData\Roaming\npm\node_modules\cordova\src\superspawn.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 Projects\HelloWorld> cordova platforms add ios
Creating ios project...
Error: C:\Users\MIGHTY\.cordova\lib\ios\cordova\3.4.1\bin\create: Command failed with       exit code ENOENT
at ChildProcess.whenDone (C:\Users\MIGHTY\AppData\Roaming\npm\node_modules\cordova\src\superspawn.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%\SDK\TOOLS. This method doesn't work. Experimentally resolved by directly pointing to the Tools and Platform Tools.

like image 941
Dilip Avatar asked May 05 '14 06:05

Dilip


1 Answers

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 :)

like image 98
Filipe Pereira Avatar answered Oct 21 '22 06:10

Filipe Pereira