NakedBrunch
NakedBrunch

Reputation: 49413

Cordova/Ionic Android: Conflicting Google Play Services versions between Push and GoogleMaps plugins

I am currently developing an Ionic app that requires the Push and GoogleMaps plugins.

If I create a blank/new project, add android platform, and install only one of the plugins then everything works perfectly. However, as soon as both plugins are installed, Android won't build.

Here's what I've done so far and is the most basic/simple way to demonstrate the problem:

  1. ionic start GoogleServicesIsues blank
  2. cd GoogleServicesIssue
  3. ionic cordova platforms add android@latest
  4. ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="123" --variable API_KEY_FOR_IOS="ABC"
  5. ionic cordova plugin add phonegap-plugin-push --variable FCM_VERSION=15.0.1
  6. ionic cordova build android

...and the build fails as it cannot find the firebase-messaging library.

Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not find com.google.firebase:firebase-messaging:15.0.1. Searched in the following locations:

file:/Users/[user]/Library/Android/sdk/extras/android/m2repository/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.jar

https://jcenter.bintray.com/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.pom

 https://jcenter.bintray.com/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.jar

https://maven.google.com/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.pom

Is anyone able to figure out how to get these two plugins to work together?

Upvotes: 2

Views: 1580

Answers (2)

Martin Zeitler
Martin Zeitler

Reputation: 76689

this is coming from the Push plugin, which lacks a dependency in the build.gradle:

api "com.google.firebase:firebase-messaging:17.3.2"

^ I have version 17.3.2 there - while you are requesting version 15.0.1.

... therefore I'd assume, that installing an existing version should fix that:

ionic cordova plugin rm phonegap-plugin-push
ionic cordova plugin add phonegap-plugin-push --variable FCM_VERSION=17.3.2

version 15.0.1 might rather be correct for the Google Play Services; to be added alike:

<framework src="com.google.android.gms:play-services-base:15.0.1"/>
<framework src="com.google.android.gms:play-services-auth:16.0.0"/>

if further dependencies should be still missing, just leave a comment below.

Upvotes: 5

Suresh Kumar Ariya
Suresh Kumar Ariya

Reputation: 9764

Please check whether this cordova plugin solves your problem. https://github.com/dpa99c/cordova-android-play-services-gradle-release

Upvotes: 1

Related Questions