Twitter: raymondcamden


Address: Lafayette, LA, USA

PhoneGap Build and PhoneGap 3.0

10-01-2013 17,442 views Mobile, JavaScript, HTML5 63 Comments

Today we officially launched PhoneGap 3.0 support for PhoneGap Build. You can read the blog post on it here: PhoneGap 3.0 Now Supported in PhoneGap Build Before you get started, there are a few things I want to call out.

The first thing you should note is that Build is not yet defaulting to 3.0 when you create a new project. If you want to use 3.0, please be sure to specify it in the config.xml file:

<preference name="phonegap-version" value="3.0.0" />

Next - if you remember my blog post on PhoneGap 3 (PhoneGap 3.0 Released - Things You Should Know), then you remember that the biggest change was to core features. In order to use any of the core features you must include the plugin for it.

PhoneGap Build also has this rule!

In order to include a core plugin with your PhoneGap Build project, simply add the gap:plugin tag to your config.xml file. Here is an example:

<gap:plugin name="org.apache.cordova.core.camera" />
<gap:plugin name="org.apache.cordova.core.geolocation" />
<gap:plugin name="org.apache.cordova.core.dialogs" />

PhoneGap Build now has a "Plugins" tab for each project. This is a great way to confirm that you set up the config.xml correctly:

If you forget the value for a particular plugin, or want to see what PhoneGap Build supports from third parties, just hit the Plugins tab at the very top of the page. The list of supported third-party plugins seems to be much improved!

Finally, don't forget to peruse the doc updates. We recently launched the ability to select a platform. among other updates.

63 Comments

  • Commented on 10-01-2013 at 3:27 PM
    Strange the plugins gelocation and dialogs error on me when i command line build to build.phonegap.com.

    Plugin Unsupported: org.apache.cordova.core.geolocation

    The com.phonegap.plugins.barcodescanner does not error.
  • Commented on 10-01-2013 at 5:07 PM
    Chad, have you updated the PhoneGap CLI recently?

    =Ryan
    ryan@adobe.com
  • Commented on 10-02-2013 at 8:14 AM
    I ran npm install -g phonegap again today and i get the same result.

    http://chadgray.info/misc/untitled-1a.jpg

    I am a total newbie to this CLI stuff so i am probably doing something wrong.
  • Commented on 10-02-2013 at 8:26 AM
    Looks like i had to add this line to my config file.

    <preference name="phonegap-version" value="3.0.0" />
  • Commented on 10-02-2013 at 8:31 AM
    Chad, I was going to mention this in my blog post but changed my mind at the last minute. Now I wish I didn't. If you remember, I said 3.0 is not the default. If you try to use the new plugins and don't specify 3.0, it will not work.
  • Commented on 10-02-2013 at 9:03 AM
    I think i picked a bad day to download the CLI yesterday. I installed and was reading up on everything before the build.phonegap.com was updated to support 3.0. I remember the website being down for about a half hour yesterday when i was experimenting.

    I will start over today and re-download everything and create new projects etc. This will give me a fresh start.

    Thanks for all the help!

    The CLI and build.phonegap.com really seems to make this a lot easier.

    Now if i can get an SSL cert out of XCODE i will be super happy to start using build.phonegap.com. We are trying to figure out all the provisioning file/SSL certificate stuff today.
  • Commented on 10-02-2013 at 3:50 PM
    Hmmm, I don't remember doing anything "CLI" related with PGB 2.x. Can someone please point out what (pertaining to this topic) boat I missed?

    Thank you
  • Commented on 10-02-2013 at 7:00 PM
    Steve, the CLI has been around for a while, but got improved over time and is integral to PG3. See the article I linked to.
  • Commented on 10-03-2013 at 8:01 AM
    Raymond,

    On the same day as announcing 3.0 support, Cordova comes out with 3.1. 3.1 has some pretty significant updates to deal with iOS 7.

    Any idea when Phonegap will be updated?
  • Commented on 10-03-2013 at 11:06 AM
    From what I know it should be pretty darn soon.
  • Anas Azeem #
    Commented on 10-05-2013 at 12:21 AM
    Hey Raymond, how are you doing today?
    I was writing the phonegap version of the Android Bluetooth Chat app, for that I was writing a plugin. The question is (please bare with my usage of inappropriate words) that how do I make a request from the (java) plugin and receive it in JS? I know that we can use the CallbackContext class to send back the result, but for that you have to initiate it from the JS itself, so how can I initiate it (a request) from the java plugin?
    Hoping for a reply. Thanks in advance.
  • Commented on 10-06-2013 at 12:42 PM
    Anas, I've never written a plugin so unfortunately I can't help. Best I can suggest is the docs. Also consider this article from my coworker:

    http://devgirl.org/2013/09/17/how-to-write-a-phone...
  • ALI3D69 #
    Commented on 10-07-2013 at 2:25 PM
    when it support webgl?
  • Commented on 10-07-2013 at 2:37 PM
    It isn't a question of PhoneGap supporting it - it is a question of the mobile browser supporting it.
  • ALI3D69 #
    Commented on 10-08-2013 at 12:49 AM
    i create game with construct 2 and i use webgl in it but when i export my game for mobile with phonegap, it didn't work!
    but for example, Firefox mobile support it.
  • Commented on 10-08-2013 at 5:27 AM
    On Android, PhoneGap uses the stock Android browser. On iOS, Mobile Safari. It does not use Firefox Mobile.
  • Commented on 10-08-2013 at 9:31 AM
    As an additional tip, I ran into this just now with an older app. I added a gap:plugin line to add Camera support, but when I uploaded the file, I got a config.xml error. Turns out, I had forgotten to add this to my root element:

    xmlns:gap = "http://phonegap.com/ns/1.0";
  • Andy Polhill #
    Commented on 10-28-2013 at 5:22 AM
    When including a phonegap plugin the documentation states that you have to reference the JavaScript code for the plugin, however I have so far found it very difficult to work out what JavaScript file to reference, the documentation doesn't seem to tell me.

    In this example I am using network-information. So I tried including network-information.js and it works, however it also works when I don't include the script, I presume in this case it won't pull in the relevant adaptor and so may fail on other devices.

    Any tips on how to include these plugins would be greatly appreciated.
  • Commented on 10-28-2013 at 5:30 AM
    Actually, no, you do not need to do so. Also see this: http://www.raymondcamden.com/index.cfm/2013/9/6/Wo...
  • Michael #
    Commented on 11-08-2013 at 6:51 PM
    Is PhoneGap 3.1 wacky with plugins? I am trying to make the switch to Build and it is very confusing. I am getting a lot of plugin not supported errors.
  • Commented on 11-09-2013 at 7:57 AM
    It shouldn't be. If you can share a precise, simple example, I can try to help. Or you can try the PhoneGap listserv too.
  • Michael #
    Commented on 11-12-2013 at 10:16 AM
    Ray if I use Phonegap CLI, add plugins I see them in my main app folder. I then build for iOS and the plugins do not show up in the platform plugin folder. I can open the project in XCode and in the yellow folders my Plugins folder is empty, yet in my www folder under plugins I see them. If I try to do a remote build the project says no plugins.

    I'm having a similar problem with splash and icon. Both are in my www/res folder, but never make it to my yellow Resources/icons or splash folders.

    I seem to have two config.xml folders too. One in the main project and one in my www folder. www config.xml points to <gap:plugin name="org.apache.cordova.inappbrowser"/> and the one in the main folder has the <feature name> structure that points to CDVInAppBrowser.
  • Michael #
    Commented on 11-12-2013 at 12:20 PM
    So here is what I discovered. There is a file in the main folder plugins that is called iOS.json. When I deleted that, reran build iOS, my plugins showed up. I had deleted the platforms iOS folder but apparently there are other files floating around with old information. I'm hoping there is one for splash and icons somewhere too.
  • Michael #
    Commented on 11-12-2013 at 1:10 PM
    No deal on splash and icons. Trying to use CLI with both local build and remote build is kind of a mess.
    Here is a nice informative CLI error:
    [error] error occured while building the iOS app
    Um... ok thanks, and the app actually built remotely.
  • Commented on 11-13-2013 at 5:16 AM
    For remote builds, you need to use www/config.xml to load plugins (and set settings like icons). It can be a bit confusing.
  • Michael #
    Commented on 11-13-2013 at 10:19 AM
    I'm attempting to use Build since that seems like a more Adobe supported route but there is a lot of confusing documentation. Plugins are really strange. We add them via CLI, then add to the www/config.xml, then add the .js in index.html? What about the ones that are core. They seem to be listed as plugins but also as features?

    Another thing I'm not really getting is if I want to build both locally and remotely I'm almost creating two projects within the main folder. The reason I feel the need to build locally is I have no idea what is being logged. In XCode I can at least view what is happening with say the GA plugin or PushWoosh. In Build I have no idea what is happening. I'm reading about some additional steps to get debug going for Build but why can't I just build a project and choose remote or local?
  • Commented on 11-13-2013 at 2:50 PM
    Everything you use now has to be added as a plugin. If you are ONLY using PGB, then you need to edit config.xml as I described. I believe you can skip the CLI to add them as you won't be building locally anyway.

    As to your second question- I'd build locally if I were trying to debug. You can do both. Not sure I quite get your question.
  • Michael #
    Commented on 11-14-2013 at 5:56 PM
    I gave up on Phonegap Build. What about icons and splash for local build? Are these not being built with CLI and we go into each OS and add? Doesn't seem like there is any documentation. My app seems to be using the www/config.xml for those and using main config.xml for other stuff.
  • Commented on 11-18-2013 at 3:19 PM
    For those, you are expected to do it as per the platform's documentation. So you would need to check Android for how to do it there, iOS for how to do it there. That's my understanding and that www/config.xml was NOT meant for anything local. But it has been a while since I last spoke to an engineer about that and I could be wrong. Best bet would be to hit the PhoneGap Google group and ask, and let us know.
  • EMMANUEL AFORO #
    Commented on 01-25-2014 at 11:18 AM
    Please I created the phonegap 3.0 . imported it into eclipse but i dont have the plugin.xml file, please how do i create it thanks.
  • Commented on 01-25-2014 at 2:57 PM
    This blog post is about PhoneGap Build, not PhoneGap itself. I don't think PhoneGap/Android uses plugin.xml. I used the CLI to make a new PG project, added Android, added the camera plugin, and I do not see a plugin.xml. As it stands, you should just let the CLI handle it.
  • Commented on 02-07-2014 at 4:02 PM
    Phonegap plugin not supported issue: For some reason the way these plugins need to be named in the config.xml isn't congruent with the documentation. For example: org.apache.cordova.camera will result in "plugin not supported: camera" but: org.apache.cordova.core.camera will build just fine. The way the plugin is listed on the phonegap plugins page is: org.apache.cordova.camera. This is NOT how you want to specify it in the config.xml file. I suspect the same is true for other plugins. Hope this helps someone.
  • Commented on 02-08-2014 at 8:19 AM
    This directly contradicts the value on the plugins site: https://build.phonegap.com/plugins. I'm going to confirm and write up a bug report.
  • Commented on 02-08-2014 at 8:24 AM
    I am not able to confirm this. The app built for me. Can you tell me more about your settings?
  • venkatesh #
    Commented on 02-27-2014 at 7:15 AM
    Hi I need phonegap plugin for bluetooth communication purpose .
    Give me advice for me
  • Commented on 02-27-2014 at 7:17 AM
    Check the plugins directory - http://plugins.cordova.io/
  • Juan Alpizar #
    Commented on 03-24-2014 at 11:03 PM
    Is it possible to use the Storage API of Phonegap (org.apache.cordova.storage) with phonegap build? I don't see the phonegap build plugin for it, and when I check the File plugin, it says the following "For an overview of other storage options, refer to Cordova's storage guide." but if I try to add a plugin with the cordova storage url it returns an error when building.

    Is this API included in the File API of phonegap build plugin or is it not yet implemented?
  • Commented on 03-25-2014 at 5:50 AM
    I believe we removed the plugins for websql as it is naturally supported. It should "just work."
  • Juan Alpízar #
    Commented on 03-25-2014 at 7:28 AM
    Oh those are great news! I'm using localStorage at the moment for a small application, but I'll check it out later for sure! thanks so much for your quick reply.
  • murali #
    Commented on 04-04-2014 at 7:18 AM
    issue with .app path (ios)
    After starting the app iam copying certain files to my Library folder and so it resides in the Library\files\....
    Now from one of the html page in this folder i want to refer to a js file in the app package, which iam unable to do.
    Earlier i was using somthing like

    <script type="text/javascript" src="../../../myapp.app/www/js/myscript.js"></script>
    which is not working now for the new file api.
    cordova version - 3.4

    Kindly let me know how i can give the path.
  • Commented on 04-04-2014 at 7:25 AM
    Hmm. If you look at the FileSystem docs, there is a compat setting you can try, but I don't think that is it. Honestly - why not just keep the JS file "under" your app? What is the point of copying it out?
  • murali #
    Commented on 04-07-2014 at 2:03 AM
    Hello Sir

    The issue is the js is in the app path,. I am moving the html file to Library\Files which has got update later. So from this file i require js functionality which aim referring to in the app path.
    <appname>.app\js\...
    please let me know
  • Commented on 04-07-2014 at 6:30 AM
    You can overwrite the existing JS under the app path - as far as I know. So why not try that?
  • murali #
    Commented on 04-08-2014 at 8:03 AM
    Hello Sir

    The issue is small but iam unable to implement it.
    I guess i did not put forth my problem right.
    On one side i have my (myapp.app) package.
    On the other side i copied few files to Library folder ( which requires future updates)
    One such file in the Library folder is an html which loads svg file.
    But this svg file refers to js files like (jquery.js, myscript.js,jquerymobile.js)
    So in this html file.
    i have to give js path which is located in myapp.app\www\js\

    <script type="text/javascript" src="../../../../../myapp.app/www/js/myscript.js"></script>

    This worked earlier before the file api update but now it does not work. It is not going inside the myapp.app path at all.

    kindly let me know your suggestion.
  • murali #
    Commented on 04-08-2014 at 8:04 AM
    sir the files (jquery.js, myscript.js,jquerymobile.js) that the SVG html file refers to are in the myapp.app package.

    Thanks
  • Commented on 04-08-2014 at 10:15 AM
    @murali: Sorry - you got me there.
  • Quentin #
    Commented on 06-25-2014 at 1:14 PM
    I'm trying to use the device-motion plugin with Phonegap build but I don't seem to be getting very far. Do I only need to add the plugin to my config.xml and then use the navigator.accelerometer methods? Or is there a step I'm missing (CLI, reference something else). I think I'm getting confused with the different documentation from PG and PG Build.
    Thanks in advance.
  • Commented on 06-25-2014 at 1:24 PM
    That should be it. If you are still having issues I'd suggest debugging.
  • Quentin #
    Commented on 06-25-2014 at 1:29 PM
    Ok. Thanks for the quick reply.
  • priolo #
    Commented on 07-04-2014 at 8:31 AM
    let's face it: PhoneGap, cordova, plugins, javascript, html .... they are a total crap. Any programmer "normal" would think.
  • Commented on 07-04-2014 at 8:53 AM
    Heh, you so funny.
  • Mike #
    Commented on 07-07-2014 at 1:56 PM
    HTML. Total crap! Javascript. Crap!
  • Commented on 07-07-2014 at 2:12 PM
    Web. Crap! Obviously it won't succeed!

    Oh wait...
  • Commented on 10-18-2014 at 8:26 PM
    hello
    i'm using phonegap 3.6.0 and cordova 3.3.1
    when i'm using adobe build phonegap i get "class not found error"
    and under the 'tab' plugins i see "This application has no plugins"
    the plugin i use is for example cordova plugin add org.apache.cordova.device
    and my own plugin.
    p.s when i'm install it through the USB it works fine but when it installed through the QR he didn't recognized the java classes.
    what can be the problem ?
  • Commented on 10-19-2014 at 4:34 AM
    You didn't say what your own plugin was - is it supported by PGB? You can't use random plugins with PGB - it has to be supported.
  • Commented on 10-19-2014 at 4:38 AM
    my plugin is notification plugin.
    i just want to know why when i install trought USB and build.phonegap i got two different result?
    and sorry but what is pgb?
  • Commented on 10-19-2014 at 4:42 AM
    PGB = PhoneGap Build.
    USB implies you built locally where your plugin works just fine, but via QR means PGB. Again, your plugin may not be supported there.
  • Commented on 10-19-2014 at 5:16 AM
    so how do i know if supported PGB OR how can i fix it ?
  • Commented on 10-19-2014 at 5:18 AM
    Click the Plugins link on top. It takes you here: https://build.phonegap.com/plugins
  • Commented on 10-19-2014 at 6:47 AM
    thanks but it didn't help me to understand why it's doesn't work.
    maybe the way i defined my plugin
    https://github.com/avishayhajbi/notification
  • Commented on 10-19-2014 at 7:08 AM
    PGB doesn't support random plugins. So when you told PGB to build your app, it couldn't include your plugin.
  • Commented on 10-19-2014 at 9:50 AM
    thank you very much.
    you helped me!

    but if i want to build something for myself can i do that?
  • Commented on 10-19-2014 at 9:03 PM
    Yes - you can use any plugin you want if you develop locally.

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty