PhoneGap Build and PhoneGap 3.0

This post is more than 2 years old.

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.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Chad posted on 10/2/2013 at 12:27 AM

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.

Comment 2 by Ryan Stewart posted on 10/2/2013 at 2:07 AM

Chad, have you updated the PhoneGap CLI recently?

=Ryan
ryan@adobe.com

Comment 3 by Chad posted on 10/2/2013 at 5:14 PM

I ran npm install -g phonegap again today and i get the same result.

http://chadgray.info/misc/u...

I am a total newbie to this CLI stuff so i am probably doing something wrong.

Comment 4 by Chad posted on 10/2/2013 at 5:26 PM

Looks like i had to add this line to my config file.

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

Comment 5 by Raymond Camden posted on 10/2/2013 at 5:31 PM

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.

Comment 6 by Chad posted on 10/2/2013 at 6:03 PM

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.

Comment 7 by Steve posted on 10/3/2013 at 12:50 AM

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

Comment 8 by Raymond Camden posted on 10/3/2013 at 4:00 AM

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.

Comment 9 by Justin Noel posted on 10/3/2013 at 5:01 PM

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?

Comment 10 by Raymond Camden posted on 10/3/2013 at 8:06 PM

From what I know it should be pretty darn soon.

Comment 11 by Anas Azeem posted on 10/5/2013 at 9: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.

Comment 12 by Raymond Camden posted on 10/6/2013 at 9: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/...

Comment 13 by ALI3D69 posted on 10/7/2013 at 11:25 PM

when it support webgl?

Comment 14 by Raymond Camden posted on 10/7/2013 at 11:37 PM

It isn't a question of PhoneGap supporting it - it is a question of the mobile browser supporting it.

Comment 15 by ALI3D69 posted on 10/8/2013 at 9: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.

Comment 16 by Raymond Camden posted on 10/8/2013 at 2:27 PM

On Android, PhoneGap uses the stock Android browser. On iOS, Mobile Safari. It does not use Firefox Mobile.

Comment 17 by Raymond Camden posted on 10/8/2013 at 6:31 PM

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"

Comment 18 by Andy Polhill posted on 10/28/2013 at 2:22 PM

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.

Comment 19 by Raymond Camden posted on 10/28/2013 at 2:30 PM

Actually, no, you do not need to do so. Also see this: http://www.raymondcamden.co...

Comment 20 by Michael posted on 11/9/2013 at 5:51 AM

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.

Comment 21 by Raymond Camden posted on 11/9/2013 at 6:57 PM

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.

Comment 22 by Michael posted on 11/12/2013 at 9:16 PM

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.

Comment 23 by Michael posted on 11/12/2013 at 11: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.

Comment 24 by Michael posted on 11/13/2013 at 12:10 AM

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.

Comment 25 by Raymond Camden posted on 11/13/2013 at 4:16 PM

For remote builds, you need to use www/config.xml to load plugins (and set settings like icons). It can be a bit confusing.

Comment 26 by Michael posted on 11/13/2013 at 9:19 PM

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?

Comment 27 by Raymond Camden posted on 11/14/2013 at 1:50 AM

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.

Comment 28 by Michael posted on 11/15/2013 at 4:56 AM

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.

Comment 29 by Raymond Camden posted on 11/19/2013 at 2:19 AM

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.

Comment 30 by EMMANUEL AFORO posted on 1/25/2014 at 10:18 PM

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.

Comment 31 by Raymond Camden posted on 1/26/2014 at 1:57 AM

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.

Comment 32 by R.D. Miller posted on 2/8/2014 at 3:02 AM

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.

Comment 33 by Raymond Camden posted on 2/8/2014 at 7:19 PM

This directly contradicts the value on the plugins site: https://build.phonegap.com/.... I'm going to confirm and write up a bug report.

Comment 34 by Raymond Camden posted on 2/8/2014 at 7:24 PM

I am not able to confirm this. The app built for me. Can you tell me more about your settings?

Comment 35 by venkatesh posted on 2/27/2014 at 6:15 PM

Hi I need phonegap plugin for bluetooth communication purpose .
Give me advice for me

Comment 36 by Raymond Camden posted on 2/27/2014 at 6:17 PM

Check the plugins directory - http://plugins.cordova.io/

Comment 37 by Juan Alpizar posted on 3/25/2014 at 8:03 AM

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?

Comment 38 by Raymond Camden posted on 3/25/2014 at 2:50 PM

I believe we removed the plugins for websql as it is naturally supported. It should "just work."

Comment 39 by Juan AlpĂ­zar posted on 3/25/2014 at 4:28 PM

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.

Comment 40 by murali posted on 4/4/2014 at 4:18 PM

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.

Comment 41 by Raymond Camden posted on 4/4/2014 at 4:25 PM

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?

Comment 42 by murali posted on 4/7/2014 at 11: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

Comment 43 by Raymond Camden posted on 4/7/2014 at 3:30 PM

You can overwrite the existing JS under the app path - as far as I know. So why not try that?

Comment 44 by murali posted on 4/8/2014 at 5:03 PM

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.

Comment 45 by murali posted on 4/8/2014 at 5:04 PM

sir the files (jquery.js, myscript.js,jquerymobile.js) that the SVG html file refers to are in the myapp.app package.

Thanks

Comment 46 by Raymond Camden posted on 4/8/2014 at 7:15 PM

@murali: Sorry - you got me there.

Comment 47 by Quentin posted on 6/25/2014 at 10: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.

Comment 48 by Raymond Camden posted on 6/25/2014 at 10:24 PM

That should be it. If you are still having issues I'd suggest debugging.

Comment 49 by Quentin posted on 6/25/2014 at 10:29 PM

Ok. Thanks for the quick reply.

Comment 50 by priolo posted on 7/4/2014 at 5:31 PM

let's face it: PhoneGap, cordova, plugins, javascript, html .... they are a total crap. Any programmer "normal" would think.

Comment 51 by Raymond Camden posted on 7/4/2014 at 5:53 PM

Heh, you so funny.

Comment 52 by Mike posted on 7/7/2014 at 10:56 PM

HTML. Total crap! Javascript. Crap!

Comment 53 by Raymond Camden posted on 7/7/2014 at 11:12 PM

Web. Crap! Obviously it won't succeed!

Oh wait...

Comment 54 by avishay posted on 10/19/2014 at 5:26 AM

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 ?

Comment 55 by Raymond Camden posted on 10/19/2014 at 1:34 PM

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.

Comment 56 by avishay posted on 10/19/2014 at 1:38 PM

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?

Comment 57 by Raymond Camden posted on 10/19/2014 at 1:42 PM

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.

Comment 58 by avishay posted on 10/19/2014 at 2:16 PM

so how do i know if supported PGB OR how can i fix it ?

Comment 59 by Raymond Camden posted on 10/19/2014 at 2:18 PM

Click the Plugins link on top. It takes you here: https://build.phonegap.com/...

Comment 60 by avishay posted on 10/19/2014 at 3:47 PM

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/avishayh...

Comment 61 by Raymond Camden posted on 10/19/2014 at 4:08 PM

PGB doesn't support random plugins. So when you told PGB to build your app, it couldn't include your plugin.

Comment 62 by avishay posted on 10/19/2014 at 6:50 PM

thank you very much.
you helped me!

but if i want to build something for myself can i do that?

Comment 63 by Raymond Camden posted on 10/20/2014 at 6:03 AM

Yes - you can use any plugin you want if you develop locally.