E-com DevBlog Spider-ball-vacuum

16Jun/1066

PhoneGap – The missing android/windows setup guide

The Introduction

Yesterday I spent a good part of the day setting up the absolutely fantastic framework PhoneGap.  If you don't know what PhoneGap is, and you are a web developer, you are truly missing out. The only thing I can compare it to (from a high level) is Adobe Air.  Air lets you build a page out of html, css, and js and then renders it in a webkit self-contained browser that you can then package up and distribute on any platform that runs air (Win/Mac/Linux), and yes you can also build Air apps with Flex and Flash.  PhoneGap is similar to Air as it too uses html, css, and js to build apps for Android, iOS, WebOS, Blackberry, Symbian, and Nokia.

Now don't let my title fool you, there is a guide (and a pretty good one at that) waiting for you in the PhoneGap Wiki, the problem is that it is now out of date and will cause you grief if you try to follow a few of the steps because they look like they are the right steps to follow.  That's why I've created this entry to walk you through the mistakes I blundered through to get it set up and working on my Windows 7 box (My mac died, and my linux lappy is a netbook - not ideal for developing on... plausible, but not ideal).

The Installation

If you point your browser toward phonegap.com you can grab the latest version of PhoneGap that is ready for the taking (note that the big download button in the top right will give you the master package, that is to say that you'll get compiled versions of phone-gap for all devices.  If you GIT in, you can pick up just the resources for the device you want to develop for).  Also you should notice a large 'Get Started' button (click that open in a new tab).

Starting on the 'Get Started' page, go ahead and click on the 'Android (Eclipse)' link. This will drop you in the wiki for setting up Android development with PhoneGap. Please note that I am writing this for version 0.9.1, so by the time you find and read this, my guide may be well out of date.  Lets follow the listed steps (with my commentary)

- Install JDK 1.6 - Yep, totally accurate and awesome, do NOT download the JRE, make sure you get the JDK (you may also need to set up a JAVA_HOME system or user variable).

- Install Eclipse - This one is wicked straight forward. Just about any 'brand' of eclipse will do, if you can hit the update site to install ADT, you can use that version of eclipse.  For the fun of it I even managed to install ADT into IBM Rational Application Developer, but you may want to stick with the vanilla Galileo version of eclipse.

- Install the Android SDK - Another fairly straight forward piece.  Download the SDK, unpack it (to root), then open it and update any of the pieces you need (in my case, everything). Once you are finished, make sure you've added the SDK to your PATH, and crack open your freshly installed eclipse and install the ADT.

- Install Apache ANT - Go and grab the latest binary of Apache Ant. After grabbing the zip, uncompress it somewhere (root sounds good), and add that path (I used the bin folder instead of the unpacked root) to your system PATH.

- Install Ruby - This step was my first hang-up.  Since I am not a Ruby programmer, and where I work refers to Ruby as the devil, I have had no previous interaction with Ruby.  So do NOT follow the original Ruby download link, instead head over to the RubyInstaller. This will install Ruby into your system without having to grab extra dependencies and monkey with your path (it contains a code monkey that does that for you ;) ). After you have installed Ruby, you are ready to attempt to install nokogiri.  Since I had never used Ruby and only knew of it as a mystical scripting language that does... uh... well... you can build things with it.  I had no idea what the line "install nokogiri via - gem install nokogiri' meant.  So I cracked open my command line and typed 'install nokogiri via - gem install nokogiri', and of course nothing happened. What you really need to type is just:

gem install nokogiri

then wait 5-10 minutes as nokogiri is downloaded and installed (there I just saved you an hour of changing your PATH, cracking open .bat files and trying to ascertain what they are doing, and surfing Google to figure out why there doesn't seem to be an 'install' or 'via' command in ruby).

-Install Git - There are plenty of ways to install git, you can use Cygwin (blech), or you can grab the nice msysgit program. Keep in mind that msysgit is in preview, so don't expect a fully-functioning, never-crashing, awesome piece of awesomnicity. But it does work, and I'm a fan of it. After you get msysgit installed, remember to generate an SSH keypair! When following the SSH keypair link, don't attempt it in command prompt, crack open 'Git Bash' from your start menu.

- Whew! Almost there! all that's left is to make sure you installed ADT and the Android SDK correctly, so follow the hello world from either a book, online tutorial, or the official hello world from Google.

- Ok, here's the second hang up, and quite the massive hang up it is.  The directions here say that you need to either roll with step 10a, or 10b.  10b says that it is the 'old way' and is what comes bundled in the "read me" for PhoneGap 0.9.1.  10a is an exercise in futility that will get you giving up and playing "The Force Unleashed" for 2 hours while you cool down by throwing storm troopers against the wall and stabbing the ones that lived with your light-saber. So just to be clear... SKIP 10A!

Lets do this instead, get your resources put into a folder, say "C:\www ". Make sure you include your icon.png file (if you don't have one, borrow the one bundled with PhoneGap - phonegap/framework/res/drawable/icon.png).  For testing purposes, I copied the files from my phonegap/example folder to C:\www  (index.html, master.css, and phonegap.js). Now lets follow the readme and run:

ruby ./droidgap \\android-sdk-windows TestGap TestGap.com C:\\www C:\\phonegap\projects\TestGap
  • Note that the double back-slashes were used because I'm running Windows 7 on my development box, if you are running a different version of windows, using the double backslashes will probably mess you up.
  • If you received a '.' is not recognized as an internal or external command, operable program or batch file. Then you left off "ruby" before "./droidgap".  droidgap is a ruby script, and as such must be called from ruby, if you had ruby on and still got that error, then you don't have ruby in your system PATH, add it and try again.  If you received any other error, you will need to correct what is broken (missing xml config, bad files, etc).
  • Another thing to keep in mind, there are a few places (including the wiki) that will tell you that your local.properties file is hosed, and you'll probably be confused because you DON'T HAVE ONE.  Don't worry about it, that is a generated file, it doesn't come pre-packaged, so don't think your download is bad when you unpack the zip and it's not there. When you run the droidgap script it will create one for you (populated off of the values entered when calling that script).

- Lets open your generated project! - Open Eclipse and File -> New -> Project. Then choose Android -> Android Project. Give your project a name, click the radio button for "Create project from existing source", and browse to your generated project folder (if you followed what I typed that would be in C:\phonegap\projects\TestGap).  Next choose the API level (for information reguarding API levels, please consult the Android docs), and click  OK.

  • Note that unless you modified your AndroidManifest.xml file, the default is '2'. My projects (once created inEclipse) threw build errors until I had changed this to a higher level (I don't remember if it was when I switched to 1.6, or 2.1, but I was playing with those two builds). Also remember that if you change the AndroidManifest.xml file, that you'll need to right-click on your project and change the build target to match (well, you don't have too, but you'll get warnings and something that looks like an error but isn't, so I'd say you *should* change the project build target to match).
  • Don't forget to add the phonegap.jar to your project. Expand the libs folder and then right-click on phonegap.jar and choose "BuildPath -> Add to Build Path", if you do forget, you'll get project errors and be unable to fix them.

Once you have the project imported/created and you are error-free, launch the app (either through the Android Emulator, or through your android phone/debugging hardware (I'm not providing the steps to setting that up, but if you have debugging hardware, you probably already know how to use it ;) ). I tested both, and while the emulator did load it, since it was an emulator, it didn't really work (hard to test an accelerometer from an emulator).  Testing on my HTC Hero though was pure beauty; geo-location worked, the beep button played my notification sound, and the accelerometer was returning good data, it was awesome!

Hopefully this will give you a good head-start into developing with PhoneGap in Windows for Android.  PhoneGap is awesome and I hope that it continues to grow, get better, and get used.  If you find it helpful, drop them a line, I know personally that they are very fast to contact and good to work with if you run into a problem.

Let me know if this entry needs any fixes, or images/screen captures to help you out with.

Print This Post Print This Post
Comments (66) Trackbacks (2)
  1. Thanks… this is very helpful. Pfff, almost 2 days working on it and it will not work at all. Your explanation of installing phonegap on windows is excellent and its running in 1 hour :)

    Thanks again,

    Dennis

  2. Glad you found it useful :D and thanks for commenting.

  3. great article!
    Lost a few hours using backslashes instead of forward slashes for pointing to the sdk :)

  4. Cheers for this tutorial. The PhoneGap ones are useless and need updating.

  5. Great to find this tutorial. I don’t understand why ruby is needed; would you explain this please?

  6. @pd
    Glad you’re happy to have found the tutorial. Ruby is needed because phonegap uses the droidgap script. That script is the main utility that converts your html/css/js into an android app, and it was written in Ruby.

    If you already have Ruby installed on your system, then there is no need to install it again, or even to change versions. Just open up your ruby command line and run the droidgap script from there.

    Note that there is a way to run the script without Ruby, instead you can use JRuby for some instruction with that visit Brian Leroux’s Phonegap Git Hub Fork. About half-way down the page you’ll find the command line instructions for using JRuby.

    Hope that helps :)

  7. Thanks for the response and information. Much appreciated!

  8. Another question, lol. What is the nokogiri install for?
    Thanks

  9. @pd
    nokogiri is a library of functions that is used in the droidgap script. It’s a gem file; gems are like jars or lib files, they work like plug-ins to help extend the language. The nokogiri package is an html, xml, parser with xpath capability, so is probably being used during conversion of your html/css/js during the droidgap script. You can find more information about nokogiri by visiting their homepage (note that they do not mention phonegap or the exact means of integration with it on their site).

  10. Hey i am trying to setup the android dev environment for phonegap, but i am stuck at the point i run the ruby script for droidgap,

    i am getting following errors
    ——————————————————–
    $ ruby ./droidgap “/e/myandroidzone/android-sdk-windows” testpg phonegap “/e/my
    androidzone/www” “/e/myandroidzone/android”
    Building the JAR…

    BUILD FAILED
    e:\myandroidzone\android-sdk-windows\platforms\android-8\ant\ant_rules_r2.xml:25
    5: Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to “C:\Program Files (x86)\Java\jre6″

    Total time: 1 second
    Creating Android project for target level 8
    Error: Target id is not valid. Use ‘android.bat list targets’ to get the target
    ids.
    Adding www folder to project…
    Generating manifest…
    Copying over libraries and assets and creating phonegap.js…
    e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `initialize’: No su
    ch file or directory – e:/myandroidzone/phonegap-phonegap-android-4e02179/framew
    ork/phonegap.jar (Errno::ENOENT)
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `copy_
    stream’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `block
    in copy_file’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1264:in `open’

    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1264:in `copy_
    file’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:471:in `copy_f
    ile’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:392:in `block
    in cp’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1396:in `block
    in fu_each_src_dest’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1410:in `fu_ea
    ch_src_dest0′
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1394:in `fu_ea
    ch_src_dest’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:391:in `cp’
    from ./droidgap:82:in `copy_libs’
    from ./droidgap:20:in `run’
    from ./droidgap:157:in `’
    ——————————————————–

  11. [update to my above post]

    - i have already set the JAVA_HOME system variable pointing to the

    C:\Program Files (x86)\Java\jdk1.6.0_21

  12. @mmg Just a guess, but are you using Windows 7? If you are that is a common error. You need to escape your slashes with another slash.

    Instead of:

    $ ruby ./droidgap “/e/myandroidzone/android-sdk-windows” testpg phonegap “/e/my
    androidzone/www” “/e/myandroidzone/android”

    Try:
    ruby ./droidgap e:\\myandroidzone\android-sdk-windows testpg phonegap e:\\myandroidzone\\www e:\\myandroidzone\android

    In the example I’m guessing that e is your hard drive letter.

    Hope that helps.

  13. Thx a lot Phil,

    after making the changes you suggested, i am getting the following error.

    $ ruby ./droidgap e:\\myandroidzone\android-sdk-windows testpg phonegap e:\\mya
    ndroidzone\\www e:\\myandroidzone\android
    Building the JAR…

    BUILD FAILED
    e:\phonegap-phonegap-android-4e02179\framework\build.xml:49: taskdef class com.a
    ndroid.ant.SetupTask cannot be found
    using the classloader AntClassLoader[]

    Total time: 1 second
    Creating Android project for target level 1
    Error: Package name ‘phonegap’ contains invalid characters.
    A package name must be constitued of two Java identifiers.
    Each identifier allowed characters are: a-z A-Z 0-9 _
    Adding www folder to project…
    Generating manifest…
    Copying over libraries and assets and creating phonegap.js…
    e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `initialize’: No su
    ch file or directory – e:/phonegap-phonegap-android-4e02179/framework/phonegap.j
    ar (Errno::ENOENT)
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `copy_
    stream’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `block
    in copy_file’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1264:in `open’

    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1264:in `copy_
    file’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:471:in `copy_f
    ile’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:392:in `block
    in cp’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1396:in `block
    in fu_each_src_dest’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1410:in `fu_ea
    ch_src_dest0′
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1394:in `fu_ea
    ch_src_dest’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:391:in `cp’
    from ./droidgap:82:in `copy_libs’
    from ./droidgap:20:in `run’
    from ./droidgap:157:in `’

  14. Hi Phil,

    i changed the phonegap -> phonegap.com and executed the ruby script, now i am getting this error.

    $ ruby ./droidgap e:\\myandroidzone\android-sdk-windows testpg phonegap.com e:\
    \myandroidzone\\www e:\\myandroidzone\android
    Building the JAR…

    BUILD FAILED
    e:\phonegap-phonegap-android-4e02179\framework\build.xml:49: taskdef class com.a
    ndroid.ant.SetupTask cannot be found
    using the classloader AntClassLoader[]

    Total time: 0 seconds
    Creating Android project for target level 1
    Adding www folder to project…
    Generating manifest…
    Copying over libraries and assets and creating phonegap.js…
    e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `initialize’: No su
    ch file or directory – e:/phonegap-phonegap-android-4e02179/framework/phonegap.j
    ar (Errno::ENOENT)
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `copy_
    stream’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1265:in `block
    in copy_file’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1264:in `open’

    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1264:in `copy_
    file’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:471:in `copy_f
    ile’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:392:in `block
    in cp’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1396:in `block
    in fu_each_src_dest’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1410:in `fu_ea
    ch_src_dest0′
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:1394:in `fu_ea
    ch_src_dest’
    from e:/MyAndroidZone/Ruby191/lib/ruby/1.9.1/fileutils.rb:391:in `cp’
    from ./droidgap:82:in `copy_libs’
    from ./droidgap:20:in `run’
    from ./droidgap:157:in `’

  15. @mmg
    There are a few things that could go wrong to give you that error.

    First make sure that you have a “framework” folder from where you are running the .droidgap script, and make sure that folder contains “phonegap.jar” (please read the thread over at google groups for a little more detail).

    When I ran the script I made sure I ran it from the directory that I had uncompressed the framework to (e:\phonegap for example). That is where my assets, example, framework, pcls folders are.

    Second thing to try is to make sure that your Android SDK is properly set up (run through the Hello World! tutorial over at developer.android.com and make sure it can compile).

    Hope that helps.

  16. Hi Phil,

    i cant find any file called phonegap.jar in the framework folder, i am thinking of doing something here is to restart the whole process with the default installation paths for each apps (ruby,ant, framework etc) and try.

    i think i have messed up somewhere there..

    thx for ur help, i will definately get back to you with results of my try.

  17. Hi, Thanks for the tutorial, but i still cannot get the ruby ./droidgap part to work, i keep getting an error:

    Building the JAR…
    ./droidgap:37:in “’: No such file or directory – ant jar (Errno::ENOENT)
    from ./droidgap:37:in `build_jar’
    from ./droidgap:16:in `run’
    from ./droidgap:157:in `’

    if possible could you expain what exactly needs to be in c://www i have placed index.html, master.css, phonegap.js from the example folder in their aswell as the icon.png

    2 days i’ve been trying, i just cant do it captain.

    I have the android-sdk-windows folder in a folder C:\\Android

    I have the phonegap-android folder in the same folder C:\\Android

    I also got a bit stuck with the PATH info, as i have never dealt with that before, if you could advise how i should do that also.

    Thankyou in-advance.
    Many Thanks
    Andy

  18. @Andy
    That error relates to ANT not being in your system PATH. Playing with your system path can be tricky, but it’s not too bad once you get the hang of it. The Path is an environmental variable that your computer uses to run applications on your system without being in the folder the application resides in.

    For Windows XP you can watchthis little youtube clip for changing your system path.

    If you learn better from reading, you can follow the Java System Path tutorial for Windows XP and Vista (should work for 7)

    If you are good with Windows shortcuts (and using Windows 7), press Win-Pause and wait for the system properties window to appear, then click on “Advanced System Settings” (left side of the window), then in the new window that pops up click on the “Environment Variables…” button (near the bottom). In the resulting window under the “System variables” scroll down until you find “Path”, then click on it (to highlight) and click the “Edit…” button. Scroll through the path and make sure that you have the bin folder of ANT inside.

    Last thing you may want to do is to go read up on the ANT installation guide (yes, it’s old… very old; Windows 98 and ME old *shudder, but it is still valid)

    Once you get all your path sorted out, you should be good. Hope this helps.

  19. Hi Phil

    i tried setting up the development environment from scratch on a new machine with window 7 (32-bit)

    i have downloaded the phonegap, but still the phonegap.jar is missing in the framework folder.

    could you send me this file on my email id, or any other place i can download it from. since the phonegap downloaded from its site does;nt have this file.

    one more concern i have is, is it a must to run the .droidgap script from the Git Bash, cant it be executed from the command prompt.

    i tried doing both and in the later case(command prompt) the error i get is only the missing phonegap.jar.

    awaiting anxiously for your reply and also to start developing android apps.

  20. Hi,

    the below 3 lines of command prompt commands did it all
    set ANT_HOME=c:\ant
    set JAVA_HOME=c:\jdk-1.5.0.05
    set PATH=%PATH%;%ANT_HOME%\bin

    i am not sure why, but creating this variables using visual interface from right clicking my computer didnt work.

    and the phonegap.jar is not available by default as a part of framework, it is somehow created when the first project is created using the script.

    anyways, thx a million for your help and this wonderful document.

  21. THANK YOU for the most comprehensive guide to installing PhoneGap on Windows. It saved us on a prototype build at the last minute when we had to re-install everything.

  22. @MMG
    Happy you got it worked out, odd that setting the path wouldn’t work in the windows GUI, but if it’s working no complaints here :)

    @ericburnley
    You are very welcome, I was understandably frustrated when I first attempted using PhoneGap, so it is nice to see that my entry here is helping. Thank you for your comment :D .

  23. For windows I had to change ant to ant.bat and android to android.bat in the droidgap file.
    I then get taskdef class com.adndroid.ant.SetUpTask not found
    To fix this I ran
    ruby ./droidgap C:/AndroidSDK TestGap TestGap.com C:/www C:/phonegap/projects/testgap
    NOTE paths use single forward slash, Android SDK value doesn’t include tools directory – just specify the root.
    Will save you a day of pain..

  24. @Russ indeed, the double slash seems to be a Windows 7 issue, thanks for throwing in some clarification and tips.

  25. Nice article. I’m stuck on the droidgap with Windows 7

    I tried

    ruby ./droidgap C:\\android-sdk-windows Bob com.bob C:\\www C:\\p
    honegap\bob

    ruby: No such file or directory — ./droidgap (LoadError)

    Ruby was installed using the method above and the installer added a path to my user variables so it should be working.

    Any suggestions gratefully accepted

  26. @Ade
    I haven’t seen that particular error before, but here are a few things to try.

    - In your ruby command window, make sure you navigate to your uncompressed phonegap sdk folder (the one that is probably titled ‘phonegap-android’), Then as odd as it sounds, when you make the call to your android sdk folder, leave off the first C: reference for the script call. So your call would look like this -> ruby ./droidgap \\android-sdk-windows Bob bob.com C:\\www C:\\phonegap\bob

    - Make sure that your folders are really where you think they are and aren’t misspelled (it really does happen, I mistype variable names on occasion and then have to debug through the code to figure out what happened to my values that no longer exist).

    - Make sure nokogiri is installed (Ruby loves to throw errors when required gems are not installed).

    The error type sounds like it just can’t find the script. Unfortunately I’m new to Ruby and haven’t had much time to play around with it. But I’m thinking that the problem really relates to either the phonegap sdk not expanding correctly, or ruby is in the wrong folder so it can’t find the script.

    Give that a shot and see if it helps you get to the next step.

  27. Thanks for your help,

    I think i needed the Ruby command window and definitely needed to navigate to the folder first!

    I had to change ant to ant.bat in droidgap and i think i changed the correct ‘android’ to android.bat

    Also needed to make sure everything from the android adk was installed. Project now created without errors but when i compile in Eclipse I get 2 errors

    bob.com.Bob does not extend android.app.Activity
    Class com.phonegap.CameraPreview does not exist

    Its probably something i’ve missed but its an extraordinary procedure to get this to work

  28. Is this can be used for iphone application also. And process will be same?
    thanks in advance

  29. @DKM
    Unfortunately you must have a computer running OSX 10.5 or 10.6 with Xcode and the iPhone SDK installed. So unless you have a hackintosh, that leaves you with Macbook, iMac, or similar. You also need a developer license to install the app on the iPhone/pod/pad. You can check out the official PhoneGap Documentation for iPhone here.

  30. Thanks Phil for your clarification, before I download all the packages and waste lots of hour.
    Please inform in future, whenever it is possible to work on windows with phonegap or any similar application. As I am not in position to buy a Mac. At present I just want to test my html+javascript on to my Iphone as a .ipa later we can think to publish to appstore. Currently I am running this as webpage locally on my iphone.
    thanks

  31. Phil, thank you for the trouble of making this tutorial, helped me a lot, especially with the nogokiri thing, i’d probably never found out about it :) ),

    anyway with some trouble i got it working.

    My advice to others is to be careful with the folders because the destination folder must be always empty when creating the phonegap.jar file, and to be carefull with the android SDK, which of them are installed, cause if the destination SDK is 8 that one is supposed with the android sdk manager.

    Thanx again Phill great tutorial!

  32. I tried

    ruby ./droidgap C:\\android-sdk-windows Bob com.bob C:\\www C:\\p
    honegap\bob

    ruby: No such file or directory — ./droidgap (LoadError)

    Ruby was installed using the method above and the installer added a path to my user variables so it should be working.

    Any suggestions gratefully accepted

  33. I tried

    C:\Documents and Settings\J@Y(-$H\Desktop\phonegap-phonegap-android-7f7cc1d>ruby
    ./droidgap D:\WientechSoftware\Android\android-sdk-windows helloandroid com.hel
    loandroid C:\www C:\Devmydroidphonegap-android
    ruby: No such file or directory — ./droidgap (LoadError)

    I have been getting stuck with this error since long time.Need solution for this
    Any suggestions gratefully accepted

  34. @Bojan
    Thanks for the comment, I’m happy you are up and running.

    @jayesh
    Another user (Ade) had a similar problem further up the comments, try those suggestions and see if they get you any further. If those suggestion do not help and you need a last resort you can try following this thread at the official phonegap Google Group. The instructions are a little vague but it does sound possible.

    As for any other things to check, make sure you have your slashes going the correct way, if you are on Windows 7 use double-slashes (in Windows 7 you need to escape your slashes).

    This doesn’t seem to be a super common problem and I haven’t run into it before. Not many people on any other groups seem to have a definitive answer for this either. If you do get past this error, please come back and let me know what you did so I can add it to the guide.

  35. hi phill
    Thanks for your reply

    I have tried below mention steps also but not getting success.

    You could try setting it up without using droidgap script
    1. create empty android prodject in eclipse
    2. copy over the src files res files form the droidgap repo.
    3. add commons-codec-1.3.jar in your workspace e.g click properties-
    >build->add jar

    4. fix up the AndoirdMainfest

    On 12 Apr, 14:47, Jacampos wrote:

    - Hide quoted text -
    - Show quoted text -
    > Hi.

    > I sorry my inexperience but, i have this error and not can to
    > continued with Getting Starter Android Tutorial.

    > D:\phonegap-phonegap-android>ruby ./droidgap D:/android-sdk-windows
    > final com.test example D:/final
    > ruby: No such file or directory — ./droidgap (LoadError)

    > D:\phonegap-phonegap-android>ruby droidgap D:/android-sdk-windows
    > final com.test
    > example D:/final
    > ruby: No such file or directory — droidgap (LoadError)

    > D:\phonegap-phonegap-android>ruby droidgap
    > ruby: No such file or directory — droidgap (LoadError)

    > No found droidgap script?

    > Thanks

    Forward
    Report spam
    Reporting spam
    Message reported
    Rate this post:

    You must Sign in before you can post messages.
    To post a message you must first join this group.
    Please update your nickname on the subscription settings page before posting.
    You do not have the permission required to post.

    larsrss
    View profile
    More options Apr 12, 10:52 pm
    From: larsrss
    Date: Mon, 12 Apr 2010 10:52:10 -0700 (PDT)
    Local: Mon, Apr 12 2010 10:52 pm
    Subject: Re: Droidgap script
    Forward | Print | Individual message | Show original | Report this message | Find messages by this author
    you also have to merge the Javscript files.

    On 12 Apr, 19:15, larsrss wrote:

    - Hide quoted text -
    - Show quoted text -
    > Hi
    > You could try setting it up without using droidgap script
    > 1. create empty android prodject in eclipse
    > 2. copy over the src files res files form the droidgap repo.
    > 3. add commons-codec-1.3.jar in your workspace e.g click properties->build->add jar

    > 4. fix up the AndoirdMainfest

    > On 12 Apr, 14:47, Jacampos wrote:

    > > Hi.

    > > I sorry my inexperience but, i have this error and not can to
    > > continued with Getting Starter Android Tutorial.

    > > D:\phonegap-phonegap-android>ruby ./droidgap D:/android-sdk-windows
    > > final com.test example D:/final
    > > ruby: No such file or directory — ./droidgap (LoadError)

    > > D:\phonegap-phonegap-android>ruby droidgap D:/android-sdk-windows
    > > final com.test
    > > example D:/final
    > > ruby: No such file or directory — droidgap (LoadError)

    > > D:\phonegap-phonegap-android>ruby droidgap
    > > ruby: No such file or directory — droidgap (LoadError)

    > > No found droidgap script?

    > > Thanks

    Forward
    Report spam
    Reporting spam
    Message reported
    Rate this post:

    You must Sign in before you can post messages.
    To post a message you must first join this group.
    Please update your nickname on the subscription settings page before posting.
    You do not have the permission required to post.
    End of messages

    By following above steps i was able to resolve Androidmenifestation.xml error But still hanging with problem. I hanging with erros in 4 and 5 different classes like

    The method registerListener(SensorListener, int, int) in the type SensorManager is not applicable for the arguments

    I think need to include phonegap.jar file as an external jar file in my android project can be solution for this class errors.
    Could you please suggest me some sites or send me that phone gap.jar file on my mail id
    “jj.maheshwari@gmail.com”

    It’s urgent really need to resolve this problem ASAP.
    Any suggestion will be appreciated.

    Thanks
    jayesh

  36. hi phill
    Thanks for help and nice article.
    I got my problem solved using below instruction.

    You could try setting it up without using droidgap script
    1. create empty android prodject in eclipse
    2. copy over the src files res files form the droidgap repo.
    3. add commons-codec-1.3.jar in your workspace e.g click properties-
    >build->add jar

    4. fix up the AndoirdMainfest

    keep in mind that when you will create new android project use android 2.1 platform otherwise you will get error in your classes.

    So, i got successfully deployed it in android emulator. But function is not getting work like
    When i clicked on deviceinfo button there is not action perform during that time and also action not working for geo-location.So please help me to resolve that problem.
    Hope to get your feed back as ASAP

    Thanking you
    jayesh

  37. I am trying to build an example app but I am getting an error reading some comment

    C:\phonegap\phonegap-android>ruby ./droidgap \\%android_home% exampleApp com.pg.exampleapp C:\\inetpub\wwwroot\exampleApp C:\\phonegap\phonegap-android\projects\exampleApp
    Building the JAR…
    ‘/*’ is not recognized as an internal or external command,
    operable program or batch file.
    ‘Licensed’ is not recognized as an internal or external command,
    operable program or batch file.
    ‘contributor’ is not recognized as an internal or external command,
    operable program or batch file.
    ‘this’ is not recognized as an internal or external command,
    operable program or batch file.
    ‘The’ is not recognized as an internal or external command,
    operable program or batch file.
    you was unexpected at this time.
    Creating Android project for target level 5
    Adding www folder to project…
    Generating manifest…
    Copying over libraries and assets and creating phonegap.js…
    C:/Ruby/lib/ruby/1.9.1/fileutils.rb:1418:in `stat’: No such file or directory – C:/phonegap/phonegap-android/framework/phonegap.jar (Errno::ENOENT)
    from C:/Ruby/lib/ruby/1.9.1/fileutils.rb:1418:in `block in fu_each_src_dest’
    from C:/Ruby/lib/ruby/1.9.1/fileutils.rb:1432:in `fu_each_src_dest0′
    from C:/Ruby/lib/ruby/1.9.1/fileutils.rb:1416:in `fu_each_src_dest’
    from C:/Ruby/lib/ruby/1.9.1/fileutils.rb:391:in `cp’
    from ./droidgap:82:in `copy_libs’
    from ./droidgap:20:in `run’
    from ./droidgap:157:in `’

  38. @jayesh
    There are problems with testing with the emulator only. Some functions will not work. If you have access to an android phone you can install your app to it and test the features. To get the GeoLocation working I had to install my app on my HTC Hero. Not sure why the time feature would not be working though.

    You may want to download the demo app with every one of the features/methods in it and try getting that up and running. If the project doesn’t work on your emulator, then there is a good chance your code is fine just the emulator or the version you are working with doesn’t support it.

    @Anang
    I’m not entirely certain why you would be getting that error. I would start with your %android_home% variable though. It may not be a fan of how you set that global variable up. If you can I’d toss it and use a direct path.

    If that doesn’t work, make sure that you have nokogiri installed (since it handles a lot of the background conversion of your html/js into the java code).

    The last thing I can think of is that the script is running but missing a dependency somewhere, it almost looks like it is trying to parse a “readme” file instead of your data.

  39. hi Phill
    Thanks for reply
    Can you please suggest me about some good sites and material reagarding mobile apps development using phone gap. Because i hardly find material for it.

  40. @jayesh
    Tutorials for development with PhoneGap is rather sparse. The most I can do is point you at a getting started site and then you’ll have to dig through the PhoneGap SDK to figure out the rest. I can tell you that not all PhoneGap features will work in your emulator, you must install the compiled app to an Android device to get full working functionality.

    You can give this getting started with PhoneGap tutorial a try, it covers a little Android and a little iPhone development (but the calls should be similar so it is still applicable).

    The next couple of links will not help you much in figuring out PhoneGap, but they are extensions you may want to keep an eye on.

    You may want to look into the JO framework that is compatible with PhoneGap to help build your app. Note that using native features (such as vibrate, geo location, etc.) will still need to be called through the PhoneGap SDK.

    Deutsche Telekom is also getting in with some PhoneGap Development with their UNIFY project. Of course they are also aiming at full cross-platform capability so they bundle xoodoo, adobe air, phonegap, and sass together in the framework.

  41. HI phill

    1. Does PhoneGap support HTML5 ( specially flash kind of video player capabilities)

    2. Does PhoneGap support native Multimedia APIs of devices to be able to play video formats.

    if yes then please.List down devices it supported above features
    Please refer me some material so that will me out to develop above list down features apps

    thanks
    jayesh

  42. @jayesh

    PhoneGap does support HTML5 (including database utilization, just remember that you only have 5mb storage

    According to the PhoneGap GoogleGroup you can playback videos the same way you would in html5. They say to put the video resources in your “www” folder and then use standard HTML5 video tags to include it in your project.

    Information on HTML5 video can be found here.

    As far as supported playback through Android you are limited a bit by hardware, however the codec support built into the OS is amazing. Here is a chart that shows the codec support for the Android OS.

    Keep in mind that different hardware manufacturers may modify the base codec list (by adding support for other formats), but that chart should give you a good idea of what is supported “out-of-the-box”.

    PhoneGap does not list any API support for media playback. There is an example of mp3 playback, but nothing listing video playback or even vendor specific API’s to call.

    If your app is a multi-media app you may want to bite the bullet and go Android native for your code (at least until further documentation is created or developed). You can find supported native (android.media) API calls here.

  43. hi phil
    Thanks for reply.

    I wanted to create ebay apps using phone gap for android.
    E.g apps like
    I wanted to fetch category ebay item list using ebay api.

    Could you please suggest me some material and sites that’s really help fool to work with ebay apps development using phonegap for android
    Hope to get your reply as soon as possible

    Thanks
    jayesh

  44. Rambo@RAZY e:/Documents and Settings/Rambo/Desktop/phonegap-android (master)
    $ droidgap C:/android-sdk-windows Hello com.hello C:\www C:\\Project1
    Building the JAR…
    Creating Android project for target level 5
    Error: Target id is not valid. Use ‘android.bat list targets’ to get the target
    ids.
    Adding www folder to project…
    Generating manifest…
    Copying over libraries and assets and creating phonegap.js…
    Adding some application name to strings.xml…
    Writing application Java code…
    Complete!

  45. what Should i do to (Error: Target id is not valid. Use ‘android.bat list targets’ to get the target
    ids.) i tired OF this Plz Tell Me IF U can Help . Thanx In advanced

  46. hi phill

    I wanted to create geo location application using phonegap
    please suggest me some material

    Thanks
    jayesh

  47. please note that Geo location app for android

  48. @Jayesh
    The only advice I can give is to read over the documentation on the site, and test with a real android device (the emulator will either not work at all or will give you an ip based geolocation – at least it used to).

    The phonegap documentation can be found at docs.phonegap.com

    The link for geolocation can be found here.

  49. Thanks for reply.

    I want to create video recording will be strem and store on server using RTSP protocol in android.
    can you please refer me some material and sites so it can be helpful me to develop such application.
    It’s in high priority need it urgently
    Suggestion will be appreciated

    Thanks
    jayesh

  50. Many Thanks for the post, your responsiveness for every comments is highly appreciated!


Leave a comment

(required)