title: An error occurred while listing Android targets
body: <p>I am getting this same error while trying to <code>add platform Android</code> to simple HelloWorld application created using <code>CLI Cordova</code> on Windows 8.</p>
  
  <p>Path vaiables has been set for
  <strong>%ANT%,%ANT_HOME%,%ANDROID_HOME%</strong><br>
  PATH Also contains 
  <strong>%ANDROID_HOME%\platform-tools</strong>  and <strong>%ANDROID_HOME%\tools</strong> in the listings.</p>
  
  <pre><code>PS E:\Android Projects\HelloWorld&gt; 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)
  </code></pre>
  
  <p>Simillar error is being raised while trying to create the same on iOS also.</p>
  
  <pre><code>PS E:\Android Projects\HelloWorld&gt; 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)
  </code></pre>
  
  <hr>
  
  <p><strong>Solved:</strong></p>
  
  <p>Thank you, <a href="http://developer.android.com/tools/devices/managing-avds-cmdline.html">the issue with Android has been resolved</a>.</p>
  
  <p>The path variable pointing to this android was wrong. I had used <strong>%ANDROID_HOME%</strong> as variable and scaled the same to path variables <strong>%ANDROID_HOME%\SDK\TOOLS</strong>. This method doesn't work. Experimentally resolved by directly pointing to the Tools and Platform Tools.</p>