androidjquerynode.jsshelljquery-mobile

Phonegap platform add android


I am having problem with Phonegap. When I want to add platform with following commands got error:

$ export PATH=${PATH}:/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/platform-tools:/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/tools 
$ cordova create hello com.example.hello "HelloWorld"
Creating a new cordova project with name "HelloWorld" and id "com.example.hello" at location "/home/matjazmav/hello"
$ cd hello
/hello$ cordova platform add android
Creating android project...

/home/matjazmav/.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/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29
    at _rejected (/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
    at /home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
    at Promise.when (/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
    at /home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
    at flush (/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)
Error: /home/matjazmav/.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: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)
hello$

enter image description here

EDIT: Here is my script, I had added ANT, JAVA and ANDROID to PATH:

#!/bin/bash
clear
export PATH=${PATH}:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/platform-tools:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/tools:/usr/lib/jvm/java-6-openjdk-amd64/bin:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/:/usr/bin/ant/
echo "$PATH"
phonegap create $1 $2 $3
cd ./$1
# phonegap platform add android # [error]
phonegap build android

Here is output (before updated last two rows):

/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/platform-tools:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/tools:/usr/lib/jvm/java-6-openjdk-amd64/bin:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/:/usr/bin/ant/
[phonegap] the options /home/matjazmav/hello com.example.hello HelloWorld
[phonegap] created project at /home/matjazmav/hello
   [error] 'platform add android' is not a node /usr/bin/phonegap command. See 'node /usr/bin/phonegap help'

Thanks!


Solution

  • You should also have

    in your PATH.