updating the version of com.google.android.gms to

2019-05-20 11:48发布

I am using Ionic 2.

I have been using Googles FCM service for push notifications. Today my pc crashed and I had to reinstall the phonegap-plugin-push plugin. Now on build, I get the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.2.0.

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

Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.2.0.

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

It looks like something must have updated, I think in the phonegap-plugin-push plugin that requires an updated dependency (i.e. com.google.android.gms to 9.2.0.)

Does anyone know how in an Angular/Ionic/Cordova/npm environement I can update this?

More Info:

enter image description here

>cordova plugin ls
cordova-plugin-camera 2.2.0 "Camera"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.3 "Console"
cordova-plugin-crop 0.1.0 "CropPlugin"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-fcm 1.1.5 "FCMPlugin"
cordova-plugin-geolocation 2.2.0 "Geolocation"
cordova-plugin-googlemaps 1.3.9 "phonegap-googlemaps-plugin"
cordova-plugin-inappbrowser 1.5.0 "InAppBrowser"
cordova-plugin-network-information 1.3.0 "Network Information"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-velda-devicefeedback 0.0.2 "DeviceFeedback"
cordova-plugin-whitelist 1.2.2 "Whitelist"
cordova-sqlite-plugin 3.0.0 "Cordova SQLite Plugin"
cordova-sqlite-storage 1.4.8 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 1.8.3 "PushPlugin"

3条回答
▲ chillily
2楼-- · 2019-05-20 12:43

got the same issue, my solution was to uninstall phonegap-plugin-push and remove android platform and then add android platform again and install phonegap-plugin-push, see below:

my actions:

ionic cordova plugin remove phonegap-plugin-push
ionic cordova platform remove android
ionic cordova plugin add phonegap-plugin-push
ionic cordova build android
ionic cordova run android

...and it works! ;)

查看更多
叛逆
3楼-- · 2019-05-20 12:45

Hi you can try to solve this buy downloading the plugin that requires the version, (i.e. com.google.android.gms to 9.2.0.) to your machine, in your case this will be the phonegap-plugin-push . open the plugin.xml file of the plugin , in the android framework section , change the section <framework src="com.google.android.gms:play-services-gcm:9.8+"/> to

<framework src="com.google.android.gms:play-services:9.2.0" />

save your work, remove the plugin from your project and add the plugin again this time adding the plugin from your location machine and not git repository.(cordova plugin add my/local/folder) .I had the same challenge but was using the cordova-plugin-admobpro together with cordova-plugin-fcm, making the changes helped me solve the problem I had,

查看更多
Lonely孤独者°
4楼-- · 2019-05-20 12:49

while i got the same error message, i saw the following towards the end of the error message also:

Found com.google.android.gms:play-services-auth:+, but version 9.2.0 is needed for the google-services plugin.
Found com.google.android.gms:play-services-identity:+, but version 9.2.0 is needed for the google-services plugin.

i fixed the issues by changing the file platforms/android/project.properties contents from

cordova.system.library.1=com.google.android.gms:play-services-auth:+
cordova.system.library.2=com.google.android.gms:play-services-identity:+

to

cordova.system.library.1=com.google.android.gms:play-services-auth:9.2.0
cordova.system.library.2=com.google.android.gms:play-services-identity:9.2.0

check if you too are seeing errors about specific gms services like the above and then make corresponding changes

查看更多
登录 后发表回答