Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ErlendEllingsen/de5ca829279d1bf8dd263aa99b9b4567 to your computer and use it in GitHub Desktop.
Save ErlendEllingsen/de5ca829279d1bf8dd263aa99b9b4567 to your computer and use it in GitHub Desktop.
Cordova build error caused by conflict between Google Play Services update and phonegap-plugin-push

phonegap plugin push gradle build error

Status: Active/relevant
Importance: BLOCKER
Reported to developer: Yes

Date reported: 20.09.2017
Date solved: N/A

Hotfix available: Yes

Category: Build
Sub-category: Android

Casued by:
	plugin: phonegap-plugin-push 2.0.0 "PushPlugin"

Description

A build error is caused by an conflict between a newer version of Google Play Services in the Android SDK and the Cordova-plugin phonegap-plugin-push 2.0.0 "PushPlugin".

When building cordova build android the following error may occur:

FAILURE: Build failed with an exception.

* Where:
Script '/Users/erlendellingsen/Documents/jobb/fearnley/fearnAppCordova/platforms/android/phonegap-plugin-push/fearnleysecurities-push.gradle' line: 38

* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 12.688 secs
Error: /Users/erlendellingsen/Documents/jobb/fearnley/fearnAppCordova/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Script '/Users/erlendellingsen/Documents/jobb/fearnley/fearnAppCordova/platforms/android/phonegap-plugin-push/fearnleysecurities-push.gradle' line: 38

Solution

There is no permanent solution available at the time of posting, however there is a workaround.

Workaround

This issue has occured to other developers as well and is discussed on Github (here). The solution to the problem is posted here.

Replace cordova.system.library.2=com.google.android.gms:play-services-analytics:+

with

cordova.system.library.2=com.google.android.gms:play-services-analytics:11.0.1 (or some other version?)

in the file

/platforms/android/project.properties

The build should now work as intended.

@coolvasanth
Copy link

I'm using ionic project. Though the above solution helps you to build without any error. I'm getting error like Cannot find module "ionic-native/push". But the PhoneGap-push plugin is already installed.

@Tluxsan
Copy link

Tluxsan commented Nov 19, 2017

@coolvasanth
add this in app.module.ts

import { Push,PushOptions } from '@ionic-native/push';

providers: [
Push
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment