Skip to content

Resolving Google Play Services conflicts

Different plugins for different frameworks can use different versions of the google-play-services library, causing your project to fail to compile or crash because the library version is outdated.

The following sections provide solutions for different plugins.

Library location

Anchor link to

You can find the Google Play Services library at <Android SDK>/extras/google.

The library is available in two formats:

  1. Monolithic jar file (containing all Google Play Services components in a single file):

    sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar
  2. Modular aar files (Android Archive), where each component is in a separate file:

    sdk/extras/google/m2repository/com/google/android/gms/…

An aar file can be stripped to a jar file (not all frameworks support aar at the moment) by unzipping the file (aar is a zip archive) and taking classes.jar - the code of the library.

1. Cordova

Anchor link to

All google play services conflicts on Cordova are resolved automatically using gradle. Sometimes (e.g., different plugins use different major versions of library) resolution may fail and there might appear two different versions of the same library in the resulting build.

2. Unity, Appcelerator Titanium

Anchor link to

You can find Google Play Services library in the plugin (or sample project). They are easy to update/change/remove to solve possible conflicts:

Terminal window
rm -rf Assets/Plugins/Android/google-play-services_lib/libs
rm -rf Assets/Plugins/Android/google-play-services_lib/res
cp ${ANDROID_HOME}/extras/google/m2repository/com/google/android/gms/play-services-analytics/8.4.0/play-services-analytics-8.4.0.aar Assets/Plugins/Android/
cp ${ANDROID_HOME}/extras/google/m2repository/com/google/android/gms/play-services-ads/8.4.0/play-services-ads-8.4.0.aar Assets/Plugins/Android/

3. Adobe Air

Anchor link to

Take the ANE extension, extract it, modify it, and repackage it.

Use the following example with PushNotification.ane:

Terminal window
unzip PushNotification.ane -d tmp

This command extracts the contents of the .ane file to the tmp directory.

Now in the tmp/META-INF/ANE/Android-ARM/ and tmp/META-INF/ANE/Android-x86/ you can find all the libraries: android-support_, play-services_, that may have been modified/updated/removed.

If you still follow the link to the document above, change tmp/META-INF/ANE/Android-ARM/platform.xml and tmp/META-INF/ANE/Android-x86/platform.xml, then zip the extension back and everything should work normally.

If you get the error:

PushNotification.ane is not a valid native extension file.

Repackage the extension using the following steps:

  1. Delete tmp/META-INF/ANE/Android-ARM/platform.xml and tmp/META-INF/ANE/Android-x86/platform.xml
  2. Modify as per guide in the link above tmp/META-INF/ANE/Android-ARM/android-depends.xml and tmp/META-INF/ANE/Android-x86/android-depends.xml instead
  3. Run the following bash commands:
Terminal window
#rename platform.xml on iOS, required to repackage the extension
mv tmp/META-INF/ANE/iPhone-ARM/platform.xml tmp/META-INF/ANE/iPhone-ARM/platform-iOS.xml
#pack the extension back with adt
cd tmp/META-INF/ANE/
“${flex.sdk}/bin/adt" -package -target ane PushNotification.ane extension.xml -swc ../../../../SWC-Pushwoosh/PushNotification.swc -platform iPhone-ARM -platformoptions iPhone-ARM/platform-iOS.xml -C iPhone-ARM/ . -platform Android-ARM -platformoptions Android-ARM/android-depends.xml -C Android-ARM/ . -platform Android-x86 -C Android-x86/ . -platformoptions Android-x86/android-depends.xml -platform default -C default/ .

You can find PushNotification.swc here: https://github.com/Pushwoosh/pushwoosh-adobe-air/blob/master/SWC-Pushwoosh/PushNotification.swc

4. Unreal Engine

Anchor link to

Unreal Engine and Pushwoosh Plugin will almost always conflict with each other. This is explained by Unreal Engine containing Google Play services by default, and different versions of the Engine use different versions of these libs. Pushwoosh plugin uses these libs as well, however a different subset. Always be careful when integrating Pushwoosh Plugin for Unreal Engine. Even if your project seems to compile and work well, ensure that both Pushwoosh and Unreal Engine use the same version of Google Play Services. Using different versions of google-play-services in one project results in undefined behavior.

To resolve a conflict you should do the following:

1. Determine which Google Play services libraries are already used in a project. Check ${UNREAL_PROJECT}/Intermediate/Android/APK/JavaLibs and ${UNREAL_PROJECT}/Intermediate/Android/APK/libs directories. For example, in the sample project created using Unreal Engine 4.15 there are following libraries:

JavaLibs:

  • downloader_library
  • play-services-ads-lite-9.2.0
  • play-services-auth-base-9.2.0
  • play-services-basement-9.2.0
  • play-services-drive-9.2.0
  • play-services-gass-9.2.0
  • play-services-plus-9.2.0
  • support-v4-23.0.0
  • play-services-ads-9.2.0
  • play-services-auth-9.2.0
  • play-services-base-9.2.0
  • play-services-clearcut-9.2.0
  • play-services-games-9.2.0
  • play-services-nearby-9.2.0
  • play-services-tasks-9.2.0
  • pushwoosh-ue-plugin // Added by Pushwoosh plugin

libs:

  • SystemUtils.jar
  • VrApi.jar
  • play-services-gcm-9.2.0.jar // Added by Pushwoosh plugin
  • play-services-iid-9.2.0.jar // Added by Pushwoosh plugin

2. If versions of play-services* libraries used in Pushwoosh and Unreal Engine do not match, remove these libraries from Pushwoosh plugin.

3. Determine which missing libraries you should add to Pushwoosh Plugin. The plugin requires android-support-v4, play-services-base, play-services-basement, play-services-gcm, play-services-iid libraries. For the sample project only play-services-gcm and play-services-iid do not overlap, so they are the only libraries that should be added in this particular case.

4. Add the library by placing the .jar file from Android SDK in https://github.com/Pushwoosh/pushwoosh-unreal-engine/tree/master/Plugins/Pushwoosh/lib/Android/libs. The location of Google Play libraries is described at the beginning of this article.

Share your feedback with us

Anchor link to

Your feedback helps us create a better experience. If you face any difficulties during the SDK integration process, share your thoughts with us via this form.