gpt4 book ai didi

android - OneSignal 导致 Google Play 服务版本发生变化

转载 作者:太空宇宙 更新时间:2023-11-03 11:23:49 25 4
gpt4 key购买 nike

我正在尝试将 OneSignal 集成到我的项目中,但它会导致 Google Play 服务出错。

这是我的build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'

dependencies {
...

implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-messaging:17.3.0"

implementation "com.google.android.gms:play-services-plus:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
implementation "com.google.android.gms:play-services-places:15.0.1"
implementation "com.google.android.gms:play-services-wallet:15.0.1"

...
}

apply plugin: 'com.google.gms.google-services'

现在,我添加了 OneSignal。

buildscript {
...

dependencies {
...

classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'

...
}
}

这是我更新的 build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

dependencies {
...

implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-messaging:17.3.0"

implementation "com.google.android.gms:play-services-plus:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
implementation "com.google.android.gms:play-services-places:15.0.1"
implementation "com.google.android.gms:play-services-wallet:15.0.1"

...

implementation 'com.onesignal:OneSignal:3.9.1'

...
}

apply plugin: 'com.google.gms.google-services'

现在,与此同步会导致错误:

Failed to resolve: com.google.firebase:firebase-core:17.3.0
...

Failed to resolve: com.google.android.gms:play-services-plus:17.3.0
...

Failed to resolve: com.google.android.gms:play-services-auth:17.3.0
...

出于某种原因,添加 OneSignal 会导致 Google Play 服务升级到我的 firebase-messaging 版本 ( 17.3.0 )

有什么办法可以解决这个问题吗?谢谢。

最佳答案

尝试使用版本范围并在项目级 gradle 中替换它

dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}

这在应用程序级别的 gradle 依赖项中

implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'

此外,您缺少 oneSignal ID(来自您当前发布的 gradle 的想法)也添加check here

一旦你完成了 syn do clean and rebuild project 选项

关于android - OneSignal 导致 Google Play 服务版本发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51900904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com