7

After much digging, i believe that this problem is related to me not having any platforms added for phonegap to build from. This is missing from their documentation.

When i trying to add a platofrm phonegap

Running code

C:\var\www\sexdiaries.co.uk\sexdiaries>phonegap platform add andriod
   [error] 'platform add andriod' is not a node C:\Users\Hutber\AppData\Roaming\npm\node_m
 See 'node C:\Users\Hutber\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js help'

Platforms

Platforms:

  keyword            | local environment | remote environment
  -------------------|-------------------|-------------------
  android            | ?                 | ?
  blackberry         | ? (BlackBerry 10) | ? (BlackBerry 6)
  ios                | ?                 | ?
  symbian            | ?                 | ?
  webos              | ?                 | ?
  wp7                | ?                 | ?
  wp8                | ?                 | ?
Community
  • 1
  • 1
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291

4 Answers4

25

For some reason, you can't add platforms in an obvious way so i found this:

You need to add platform to work with, whilst the documentation is so very very poor:

Command

   phonegap build android

build

C:\var\www\sexdiaries.co.uk\sexdiaries>phonegap build android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
 [warning] missing library cordova/android/3.0.0
[phonegap] downloading https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=snapshot;h=3.0.0;sf=tgz...
[phonegap] compiling Android...
[phonegap] successfully compiled Android app

Then you are good to go, doing an import with Andriod Studio will also work now as you have a project to work with :)

Fantastic.

Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291
  • 4
    Needing my own SO questions over and over again :0 – Jamie Hutber Sep 27 '13 at 15:05
  • 2
    Thanks for discovering this. The phonegap documentation is very poor and still refers to all the Cordova commands which are not valid. – Matt__C Nov 27 '13 at 18:23
  • I tried this solution but I still get an error [phonegap] adding the Android platform... [error] An error occured during creation of android sub-project. – Lion789 Jan 15 '14 at 22:04
  • 1
    Have you added ant to your paths? Have you got `ANDROID_HOME` in your path pointing to your SDK folder? – Jamie Hutber Jan 16 '14 at 07:24
  • @jamie Hutber i have same issue as Lion789 got. ant is not added to my path. how to add it – Charan Giri Jan 27 '14 at 05:55
  • 1
    I would google this :) its not too difficult, but you'll need a guide with images if you've never done it before. – Jamie Hutber Jan 27 '14 at 10:04
  • 1
    `phonegap build android` didn't work for me but didn't output any error messages. However `phonegap local build android` did output what the error was. – Keith Mar 14 '14 at 18:53
2

your command is like this "phonegap platform add andriod"

But it is android, not andriod

you need to change andriod to android.

user2915097
  • 30,758
  • 6
  • 57
  • 59
1

For anyone else still having problems, I found that using the run command works as well.

Brian
  • 2,494
  • 1
  • 16
  • 21
0

Actually you might have them ready and working but on windows there is an ACSII bug... instead of showing ✔ and ✖ it shows ?.

http://www.raymondcamden.com/index.cfm/2013/8/15/Using-the-PhoneGap-CLI-on-Windows-Watch-out-for-this-bug

rain01
  • 1,194
  • 1
  • 16
  • 25