Does Urban Airship work with PhoneGap Build on Android?

  • 2
  • Question
  • Updated 4 years ago
  • Doesn't Need an Answer
I've used the Urban Airship com.urbanairship.phonegap.pushnotification PhoneGap plugin as part of an app being built by PhoneGap Build.
It build fine & works completely on iOS but the Android build fails with the following error in the log:

BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:601: The following error occurred while executing this line:
/project/com.urbanairship.phonegap.PushNotification/google-play-services/custom_rules.xml:6: /home/ec2-user/android-sdk/extras/google/google_play_services/libproject/google-play-services_lib does not exist.


Is there some setting that needs to be set or something else that I could be doing wrong, or is this a problem with the plugin on PGB?

The urban airship settings from config.xml are:

<preference name="com.urbanairship.production_app_key" value="Your production app key" />
<preference name="com.urbanairship.production_app_secret" value="Your production app secret" />
<preference name="com.urbanairship.development_app_key" value="REMOVED" />
<preference name="com.urbanairship.development_app_secret" value="REMOVED" />
<preference name="com.urbanairship.in_production" value="false" />
<preference name="com.urbanairship.gcm_sender" value="REMOVED" />
<preference name="com.urbanairship.enable_push_onlaunch" value="true" />
Photo of Josh Keegan

Josh Keegan

  • 5 Posts
  • 0 Reply Likes

Posted 5 years ago

  • 2
Photo of Simon MacDonald

Simon MacDonald

  • 5 Posts
  • 0 Reply Likes
I'm running into the exact same problem.
Photo of Yi Ming Kuan

Yi Ming Kuan

  • 1840 Posts
  • 78 Reply Likes
Hi Josh,

Try adding the com.google.playservices plugin from plugins.cordova.io:
<gap:plugin name="com.google.playservices" source="plugins.cordova.io" />
-yiming
Photo of Josh Keegan

Josh Keegan

  • 5 Posts
  • 0 Reply Likes
This hasn't fixed it, the build still fails with the same error message as before.
Photo of Kapil Chawala

Kapil Chawala

  • 4 Posts
  • 0 Reply Likes
I am also facing the same problem. Does some one got the solution to it.
Photo of Simon MacDonald

Simon MacDonald

  • 5 Posts
  • 0 Reply Likes
Run the "android" command from a terminal and when the GUI comes up scroll down to the bottom looking for the "Extras" section. Make sure that "Google Play services" is installed. If not install it and re-build.

There are some other issues with UA as they need you to do some manual steps to get the plugin to work. I'm hoping to submit a pull request to UA this week to fix this so the plugin will work better on PGB.
Photo of Kapil Chawala

Kapil Chawala

  • 4 Posts
  • 0 Reply Likes
Google play services is installed and when I build the project from eclipse using UA push notification plugin , it is working fine. But I want to build using PGBuild but it showing
BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:601: The following error occurred while executing this line:
/project/com.urbanairship.phonegap.PushNotification/google-play-services/custom_rules.xml:6: /home/ec2-user/android-sdk/extras/google/google_play_services/libproject/google-play-services_lib does not exist.

I think something is missing at PGBuild side where it looks for google play services.
Photo of Simon MacDonald

Simon MacDonald

  • 5 Posts
  • 0 Reply Likes
Okay then it is probably issue that UA details on step 9 of their README (https://github.com/urbanairship/phone...). I'm going to write a hook that will do it for you and submit to UA this week.
Photo of Kapil Chawala

Kapil Chawala

  • 4 Posts
  • 0 Reply Likes
Okay thanks .
Please notify me when it get resolved.
Photo of Simon MacDonald

Simon MacDonald

  • 5 Posts
  • 0 Reply Likes
Please try my fork of the plugin at https://github.com/macdonst/phonegap-.... I hope that it resolves all of your issues. I've also submitted a pull request to UA as well. Go comment on it if it fixes things for you.

https://github.com/urbanairship/phone...
Photo of Kapil Chawala

Kapil Chawala

  • 4 Posts
  • 0 Reply Likes
Hi,
I am uploading zip file of my code to make a build using phone gap build , but still getting build failed error. The error log is at

https://build.phonegap.com/apps/13019...
Photo of Florent Valdelievre

Florent Valdelievre

  • 10 Posts
  • 0 Reply Likes
Same problem here, anyone ?


BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:601: The following error occurred while executing this line:
/project/com.urbanairship.phonegap.PushNotification/google-play-services/custom_rules.xml:6: /home/ec2-user/android-sdk/extras/google/google_play_services/libproject/google-play-services_lib does not exist.


Same problem when adding:


<gap:plugin name="com.google.playservices" source="plugins.cordova.io" />
Photo of Simon MacDonald

Simon MacDonald

  • 5 Posts
  • 0 Reply Likes
Please try again as I believe the issue has been resolved.
Photo of Steve

Steve

  • 22 Posts
  • 1 Reply Like
Hi,

I'm still having this problem using UA plugin v2.7.0 but would actually like to use 4.0.1 which is latest version.

I currently have:-

<gap:plugin name="com.urbanairship.phonegap.pushnotification" spec="2.7.0" source="pgb" />

I tried using:-

<gap:plugin name="urbanairship-cordova" version="4.01." source="npm" />

This builds but doesn't load the plugin so when I remote JS inspect the UAirship object is just not there.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Steve,
did you include phonegap.js?
Are you waiting for deviceready before you take any action?

Sorry I can't find a better reference for this: deviceready
You can also read #4 of Top Mistakes by Developers new to Cordova/Phonegap

Jesse
Photo of Steve

Steve

  • 22 Posts
  • 1 Reply Like
Hi,

I am only having this problem with UA plugin, my app works fine with other plugins, etc...

The issue is well described above but only solution that I've found which I haven't tried so far is to build my app without PGB!

I am trying to still use PGB as the convenience is very useful but this is the first issue that is causing me to maybe abandon PGB?

Thanks, Steve
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
It would help to know the name of the plugin.

Not all plugins work with Phonegap Build

In general, if the plugin is in plugin respository, it can be use.

It appears there are two (2) plugins available.

The lines in your config.xml would look like this.


<plugin name="urbanairship-cordova" source="npm" spec="4.0.1" />

or

<plugin name="com.madmobile.phonegap.pushnotify" source="npm" spec="1.0.1" />


In the future, starting a new thread is better that working from an old thread. This thread was marked "doesn't need answer". I happened across it by accident.

Oh and read the latest blog entries. https://build.phonegap.com/blog

Almost forgot, if the plugin is not working, speak with the author.

Best of Luck,
Jesse
Photo of Steve

Steve

  • 22 Posts
  • 1 Reply Like
Hi Jesse,

I wouldn't be raising any request here if I hadn't exhausted all other possibilities.

I found that v2.7.0 of the Urban Airship plugin available from PGB doesn't work for Android and this is widely reported in various articles. (NOTE: This plugin does seem to install and work for iOS)

I then tried to use the first of the options you described above, i.e. urbanairship-cordova from npm (as many articles suggest using this instead) but even though the build works when I inspect the plugins tab of the build it doesn't show as having been installed.

When I then remote inspect the javascript on android device the UAirship object is not loaded and so plugin has not been loaded.

I'm simply trying to work out why the urbanairship-cordova v4.0.1 plugin does not install from npm? Simon MacDonald in previous post said that he believed that this issue had been resolved and even provided a pull request but I don't think this is resolved.

I am signed up with Urban Airship to provide my push notifications and intend to use their service, hopefully I can do this while still using PGB?

Sorry for lengthy response but I've really tried every possible alternative from every support article I can find online and nothing working with PGB. I really want to avoid having to start building all my packages locally again but if I can't achieve this with PGB then I'll need to do that and stop using PGB?

I don't really want to clog up this ticket with lengthly responses so if you think this is best dealt with in another thread then I can raise that, it's just that this thread exactly describes my issue and I don't think it really has been adequately resolved one way or the other?

Thanks, Steve
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Steve,
okay at this point we start to work the other end of the problem.
What is your target platform? Android, iOS, etc.
What are your target version? iOS7,iOS8, etc, Android 3.x, 4.x, SDK-22
What is the target version of your compiler? cli-5.1.1, cli-5.2.0
Have your tried other Urban airship version ? Such as 4.0.0, 3.6.0, etc..
What are your test platforms? emulators and physical devices?

FWIW iOS9 and Android 6.0 have been causing problems across the board for all plugins and all Apps.

TIA
Jesse
Photo of Steve

Steve

  • 22 Posts
  • 1 Reply Like
Hi Jesse,

I am targetting Android and iOS of no particular version, just latest as defaulted by PGB...

cli-5.2.0 (3.9.1 / 4.1.1 / 3.8.1)

I've tried various versions of UA plugin from npm, almost all release versions from 2.7.0 -> 3.5.0 -> 4.0.1

In terms of test I generally just test on actual devices and use either WEINRE or VorlonJS for remote JS debug

In terms of devices I have iPhone6s, iPad Air, Samsung S6 Edge, Nexus 7 tablet

If I use v2.7.0 of UA plugin sourced directly from PGB then it seems to work for iOS but this does not work for Android.

If I use 3.5.0 from npm then the build does not complain but when I then remote debug the JS the UAirship JS object is not loaded and also I cannot see any reference to the plugin being loaded. I haven't as yet tested this version on iOS because my problems seem to be on Android.

If I attempt to use v4.0.1 of the plugin then the 'log' for the app build says that it requires >= 5.4.0 of the cordova CLI.

I've tried to list as many combinations as I can but given that I've spent the best part of 2 days trying everything I could possibly think of and every article I found there are obviously many combinations.

My latest hope is that v5.4.0 of cordova may well fix things so if it's in the not too distant future then I can wait a short while and continue with other areas of the app development.

I also have the option to start building locally again which is how I began before PGB but this obviously requires a lot of setup and I've only ever built locally for Android so I've avoided this option so far since PGB is just so convenient.

OK, I'm sure you'll have more questions. Each option I try seems to fail in a slightly different way, e.g. 3.5.0 in the 'log' seems to load the plugin from npm OK but then there are loads of java compile errors lower down the log which I'm not sure are relevant or just warnings.

Thanks in advance for any guidance/suggestions on this, Steve
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Steve,
unless one of the other @volunteers or @support has an idea, it looks like you have tried everything.

Here are the issues you should be aware of - when working on the leading edge. These bullet points center around versioning.

Cordova Releases

  1. Tools Release (aka Cordova CLI) is the leading branch - as soon as the "Release blog" is posted.
  2. The "Release" Cordova "Core" Plugins are always behind the leading branch. "Release" are those that are mentioned in the "Release blog" post for the "core" plugins; this differs from the "Tools Release".
  3. Cordova "Core" Plugins can, and often do, advance before the next "Release".
  4. Cordova "Core" Plugins occasionally break. This requires a "hot patch", and an immediate advance in the version. This is rare, but it happens.
  5. Cordova Third-Party plugins are independent, and advance on there own pace. Their version may or may not coincide with "Tools Release". However in practice, Third-Party plugins make changes or addendums soon after "Tools Release"


Phonegap Releases

  1. Phonegap CLI generally has the leading branch, just days after the "Tools Release".
  2. Phonegap Build is always behind the leading branch. It takes weeks for Phonegap Build to align with the "Tools Release".
  3. Recently, Phonegap adbandoned the Phonegap Build Repository in of the Cordova Plugin Repository. This means Plugins are available (for both CLI and Build), that were not before. However, this has the caveats ths follow.


Phonegap Build Plugins Caveats

  1. Plugin authors are still responsible for the plugins.
  2. Phonegap Build may not support all the Cordova "build hooks" needed by a Plugin author.
  3. Plugins must be in the Cordova (NPM) Plugin Repository. This excludes plugins that are NOT in the Repository; including many plugins listed in github.
  4. Sometimes the most recent release of a Third-Party plugin requires the most recent "Tools Release". This means the most recent release of that Third-Party plugin will not work.
  5. Sometimes for a Third-Party plugin to work with Phonegap Build a developer must use a previous version of the Third-Party plugin.
  6. There are more properties for Third-Party plugin. I have been unable to identify them.


NOTES: Cordova Official Release Policy AKA versioning and release strategy

Jesse
Photo of Steve

Steve

  • 22 Posts
  • 1 Reply Like
OK, great...

Thanks for the comprehensive reply
Photo of Luke Bryan

Luke Bryan

  • 2 Posts
  • 0 Reply Likes
Hi Steve,

Seems I'm having the same issues you were having exactly. Did you end up resolving it?

Regards,
Luke.
Photo of Steve

Steve

  • 22 Posts
  • 1 Reply Like
Hi Luke,

Unfortunately I didn't solve the problem with PGB.

I was initially waiting for CLI-5.4.0 to be supported by PGB which I hoped would let me use 4.0.1 of the UA plugin but eventually gave up and reluctantly went back to building my PG apps locally with Android SDK and iOS Xcode.

This was a little easier than I remembered from way earlier when I used to build locally so if you can't get it working with PGB then I guess that's all I can recommend.

If you need any more pointers let me know...

Good luck! Steve
Photo of Luke Bryan

Luke Bryan

  • 2 Posts
  • 0 Reply Likes
Hi Steve,

Thanks for the update.

As I rely on PGB for my iOS builds (no Mac here) I'm going to have to ditch UA.

After a bit of research we've decided to try out Pushwoosh which appears to have a similar feature set to UA only its PG plugin is supported by PGB. See how that goes.

Cheers!

Luke.