Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap Error: "An error occurred while listing Android targets" while installing Phonegap on Ubuntu

http://cordova.apache.org/docs/en/3.3.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide

As metioned in the above doc, I have already installed the required software for Phonegap as I have getting versions:

For Java:

$ java -version java version "1.7.0_51" Java(TM) SE Runtime

Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM
(build 24.51-b03, mixed mode)

For ANT

$ ant -version

Apache Ant(TM) version 1.8.2 compiled on December 3
2011

For Node.JS

$ npm -version

1.4.3

Now, the problem is when I create a phonegap project for Android like this "$ cordova create hello com.example.hello HelloWorld", it creates the project directory with "hello" name.

But now, when I enter this command "$ cordova platform add android" in "hello" directory, it gives me the error given below:

/hello$ cordova platform add android Creating android project...

/home/deep/.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 /home/deep/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29 at _rejected (/home/deep/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24) at /home/deep/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30 at Promise.when (/home/deep/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31) at Promise.promise.promiseDispatch (/home/deep/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41) at /home/deep/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44 at flush (/home/deep/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17) at process._tickCallback (node.js:415:13) Error: /home/deep/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8 at ChildProcess.whenDone (/usr/lib/node_modules/cordova/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)

How to get out of this problem?

like image 583
Deep Mehta Avatar asked Mar 21 '14 06:03

Deep Mehta


1 Answers

I could fix this issue by following the cordova-guide. in short:

  1. download the adt-bundle
  2. unzip it to a location of my choice
  3. add the named folders to the PATH variable:

    export PATH=${PATH}:/home/me/opt/adt-bundle/sdk/platform-tools:/home/me/opt/adt-bundle/sdk/tools

like image 115
smoebody Avatar answered Sep 19 '22 14:09

smoebody