【发布时间】:2023-03-23 16:10:01
【问题描述】:
我有一个 firebase flutter 应用程序,一切正常,但是当我添加 firebase_messaging: ^5.1.4.该应用程序给出了这个:
FAILURE:构建失败并出现异常。
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[18.0.
0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-messaging:18.0.0 -> com.google.firebase:firebase-iid@[18.0.0], but fire
base-iid version was 19.0.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends on project 'firebase_messaging' which depends onto com.google.firebase:firebase-messaging@18.0.
0
-- Project 'app' depends onto com.google.firebase:firebase-core@17.0.0
-- Project 'app' depends on project 'cloud_functions' which depends onto com.google.firebase:firebase-functions@17.0.0
-- Project 'app' depends on project 'firebase_core' which depends onto com.google.firebase:firebase-core@16.0.9
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
这些是我的其他包
firebase_auth:^0.11.1+12 firebase_storage:^3.0.4 cloud_firestore: ^0.12.7+1 cloud_functions: ^0.4.1+1
(它们都有效)
我的构建 gradle 中有这个:classpath 'com.google.gms:google-services:4.2.0'
实现 'com.google.firebase:firebase-core:17.0.0'
有没有办法解决这个问题?
非常感谢!
【问题讨论】:
-
对我来说一切似乎都很好。您确定您已经完成了适用于 Android 和 iOS 的 firebase 核心和 firebase 消息传递的整个初始设置过程吗?
-
目前还没有ios,因为我需要有一个开发者账号。奇怪的事情:当我添加版本时: firebase_messaging: ^4.0.0+4 它可以工作.....只有一些“错误”,即令牌未注册或其他东西,但应用程序运行
-
我通常不指定包的版本,而且大部分时间都可以使用。让 pubspec 文件自己处理版本似乎是一种更好的做法。当然,如果您不是在寻找您尝试安装的版本的特定功能
-
不,只是想要推送通知。当 pub 处理版本时,它会给出相同的错误
-
但是当我使用版本 4 时,它会在运行时出错,并在发送通知时使应用程序崩溃 拒绝在以前失败的类 java.lang.Class
:java.lang.NoClassDefFoundError:解析失败:Lcom/google/firebase/iid/FirebaseInstanceIdService;