【问题标题】:Cordova/Ionic Android: Conflicting Google Play Services versions between Push and GoogleMaps pluginsCordova/Ionic Android:Push 和 GoogleMaps 插件之间的 Google Play 服务版本冲突
【发布时间】:2019-02-14 04:18:31
【问题描述】:

我目前正在开发一个需要 PushGoogleMaps 插件的 Ionic 应用程序。

如果我创建一个空白/新项目,添加 android 平台,并且只安装其中一个插件,那么一切都会完美运行。但是,一旦安装了这两个插件,Android 就不会构建。

这是我迄今为止所做的,是演示问题的最基本/最简单的方法:

  1. ionic 启动 GoogleServicesIsues 空白
  2. cd GoogleServicesIssue
  3. ionic cordova 平台添加 android@latest
  4. ionic cordova 插件添加 cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="123" --变量 API_KEY_FOR_IOS="ABC"
  5. ionic cordova 插件添加 phonegap-plugin-push --variable FCM_VERSION=15.0.1
  6. ionic cordova build android

...构建失败,因为它找不到 firebase-messaging 库。

无法解析所有配置文件 ':app:debugCompileClasspath'。

找不到 com.google.firebase:firebase-messaging:15.0.1。在以下位置搜索:

文件:/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

有谁知道如何让这两个插件一起工作?

【问题讨论】:

    标签: android cordova firebase ionic-framework google-play-services


    【解决方案1】:

    这来自Push 插件,它在build.gradle 中缺少依赖项:

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

    ^ 我有版本 17.3.2 那里 - 而你正在请求版本 15.0.1

    ...因此我假设,安装现有版本应该可以解决这个问题:

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

    15.0.1 版本可能更适合 Google Play 服务;相同添加:

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

    如果仍然缺少其他依赖项,请在下方留言。

    【讨论】:

    • 有趣。新版本也需要重新安装 GoogleMaps 插件,但这看起来很有希望。
    • @NakedBrunch 自从引入了新的版本控制方案后,Firebase 和 Google 服务的版本号可能会有所不同......并不总是这样。
    • 安装现有版本无效。明确要求 FCM 版本 17.3.2 是诀窍。感谢您发现这一点!
    【解决方案2】:

    请检查此 cordova 插件是否解决了您的问题。 https://github.com/dpa99c/cordova-android-play-services-gradle-release

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-13
      相关资源
      最近更新 更多