如何解决“ Google服务版本冲突(地图/ FCM)”

时间:2019-09-25 11:39:47

标签: google-maps ionic-framework google-play-services ionic4 cordova-plugin-fcm

在此链接中添加google map插件后会发生问题     https://github.com/mapsplugin/ionic-googlemaps-quickdemo-v4

此google map在ios中工作正常,但是当我尝试在android上运行它时 收到此错误

[cordova] * What went wrong:
[cordova] Execution failed for task 
':app:processDebugGoogleServices'.
[cordova] > 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 10.+.
[cordova] 
[cordova] * Try:
[cordova] Run with --stacktrace option to get the stack trace. Run 
with --info or --debug option to get more log output. Run with -- 
scan to get full insights.
[cordova] 
[cordova] * Get more help at https://help.gradle.org
[cordova] 
[cordova] BUILD FAILED in 38s
[ERROR] An error occurred while running subprocess cordova.

    cordova build android exited with exit code 1.

我尝试了所有这些解决方案,但不适用于我,但适用于某人

1- https://forum.ionicframework.com/t/ionic-processdebuggoogleservices-version-conflict/132560

2- https://github.com/arnesson/cordova-plugin-firebase/issues/1093

3- https://forum.ionicframework.com/t/execution-failed-for-task-app-processdebuggoogleservices-please-fix-the-version-conflict-either-by-updating-the-version-of-the-google-services-plugin-version-of-com-google-android-gms-to-11-8-0/125610

4- https://forum.ionicframework.com/t/google-services-version-conflict-maps-fcm/93695/51

5- https://forum.ionicframework.com/t/google-services-version-conflict-maps-fcm/93695

1 个答案:

答案 0 :(得分:3)

发生问题是因为我正在使用FCM插件中的旧版本,因此在添加Google Map插件之前可以正常工作,因为10. +和15.0.1不相同且不兼容,因此发生了冲突。

   cordova.system.library.2=com.google.firebase:firebase-core:10.+
   cordova.system.library.3=com.google.firebase:firebase-messaging:10.+.

cordova.system.library.4=com.google.android.gms:play-services-maps:15.0.1
cordova.system.library.5=com.google.android.gms:play-services-location:15.0.1

这些步骤的解决方案对我来说非常简单有趣

1-使用此命令卸载fcm插件。

ionic cordova plugin rm cordova-plugin-fcm-with-dependecy-updated

2-安装fcm插件

ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated

3-删除android平台

ionic cordova platform rm android

4-添加android平台

ionic cordova platform add android

现在一切正常

转到android平台并打开project.properties  你发现了变化 这样

cordova.system.library.2=com.google.firebase:firebase-core:16.0.9
cordova.system.library.3=com.google.firebase:firebase-messaging:18.0.0 

现在运行

ionic cordova运行android

我希望对大家有帮助。