title: Cordova for android: An error occurred while listening android targets
body: <p>I have read all the questions for the same problems and I have tried everything but nothing is working for me when I try to add android platform for cordova.</p>
  
  <pre><code>c:\Apps\fapp&gt;cordova platform add android
  Creating android project...
  
  C:\Users\Andrej\.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\Andrej\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:
  87:29
      at _rejected (C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_mo
  dules\q\q.js:808:24)
      at C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.j
  s:834:30
      at Promise.when (C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node
  _modules\q\q.js:1079:31)
      at Promise.promise.promiseDispatch (C:\Users\Andrej\.cordova\lib\android\cor
  dova\3.4.0\bin\node_modules\q\q.js:752:41)
      at C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.j
  s:574:44
      at flush (C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_module
  s\q\q.js:108:17)
      at process._tickCallback (node.js:415:13)
  Error: cmd: Command failed with exit code 8
      at ChildProcess.whenDone (C:\Users\Andrej\AppData\Roaming\npm\node_modules\c
  ordova\src\superspawn.js:112: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>
  
  <ul>
  <li>Project is created using <strong>cordova create fapp com.fapp Fapp</strong> </li>
  <li>System is windows 8</li>
  <li>ANT, JAVA (JDK 1.7.0_51 and JRE7),  Android SDKs are installed from (17-19.0.3) and Android APIs (17-19)</li>
  <li>All environment variables for JAVA, ANDROID and ANT are set as well as path to bin for all of them into Path variable.</li>
  </ul>
  
  <p>I really tried everything but keeps throwing this problem. </p>
  
  <p>EDIT:</p>
  
  <ul>
  <li>Answer here did not help:
  <a href="https://stackoverflow.com/questions/21699585/cordova-ubuntu-an-error-occurred-while-listing-android-targets">cordova ubuntu: An error occurred while listing Android targets</a></li>
  <li>Permissions are set to Everyone full control and same issue</li>
  </ul>
  
  <p><strong>FINAL SOLUTION</strong></p>
  
  <ul>
  <li>Finally I re-installed JDK and Android SDK and now everything works even it is still mystery to me.</li>
  </ul>