我今天开始收到此错误,昨天一切正常,gradle或firebase版本没有变化
com.google.firebase:firebase-iid库是由以下人员请求的 [[17.0.0,17.0.0]]的其他各种库,但解析为16.2.0。 禁用插件并使用./gradlew检查您的依赖关系树 :app:依赖项。
I saw that yesterday was update in google-services plugin,可能是引起问题的原因。
如何解决此问题?
答案 0 :(得分:26)
我有同样的问题。一个快速的解决方法是禁用导致此问题的严格版本检查。添加
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
位于应用程序build.gradle文件的最底部。
答案 1 :(得分:8)
我有同样的问题。我通过将Firebase消息更新到最新版本来解决了该问题。
implementation 'com.google.firebase:firebase-messaging:17.0.0'
到
implementation 'com.google.firebase:firebase-messaging:17.3.4'
它已解决
答案 2 :(得分:7)
如果您遇到此问题,可能会看到很多帖子说可以禁用此检查。我不喜欢这样做,因为它隐藏了问题。
一段时间后,我终于明白这是在说某个图书馆要的是我没有的版本。所以我在build / app / build.gradle中添加了它,并构建了
implementation "com.google.firebase:firebase-iid:17.0.2"
仅使用您认为是16.2.0的版本即可。
答案 3 :(得分:4)
我今天遇到了同样的错误。我正在使用react-native-firebase
和react-native-push-notification
。运行./gradlew :app:dependencies
时,我发现react-native-push-notification
需要最新版本的com.google.firebase:firebase-messaging
,而最新版本又需要com.google.firebase:firebase-iid:[17.0.0]
,从而导致错误。
我为firebase-messaging
手动指定了react-native-push-notification
的早期版本,如here所述。那为我解决了这个问题:
// in android/build.gradle
ext {
firebaseVersion = '17.1.0' // add this line
// ...
}
答案 4 :(得分:4)
对我来说,禁用版本检查不能解决问题。我所做的是从firebase消息库中排除firebase-iid模块,并将其单独添加
implementation ("com.google.firebase:firebase-messaging:17.3.4"){
exclude group: 'com.google.firebase', module: 'firebase-iid'
}
implementation 'com.google.firebase:firebase-iid:17.0.3'
答案 5 :(得分:2)
我想我来晚了,但是也许这个解决方案可以解决某人的问题。
在build.gradle中,将com.google.gms:google-services:4.0.0
更新为com.google.gms:google-services:4.3.3
解决了我的问题。
答案 6 :(得分:1)
对我来说,这是node_modules / @ aws-amplify / pushnotification中的build.gradle文件(对react-native-push-notification中的build.gradle文件也是如此)
更改firebase软件包的版本号以匹配您自己的app / build.gradle文件中的版本。
对我来说是
compile 'com.google.firebase:firebase-messaging:17.6.0'
compile 'com.google.firebase:firebase-core:16.0.8'
答案 7 :(得分:1)
我有同样的问题。这是在之后添加的 应用插件:“ com.google.gms.google-services” com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
位于您的应用程序build.gradle文件的最底部,我的问题已解决
答案 8 :(得分:1)
我遇到了同样的问题,但是我通过将所有Firebase依赖关系更新为最新的依赖关系来解决了这个问题。
// Firebase
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.firebaseui:firebase-ui-firestore:5.0.0'
implementation 'com.firebaseui:firebase-ui-storage:5.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'
答案 9 :(得分:1)
我遇到了类似的问题,但是出现了错误消息;
依赖项失败:com.google.firebase:firebase-messaging:17.0.0-> com.google.firebase:firebase-iid @ [16.0.0],但使用fire base-iid版本 是19.0.0。
并通过在应用程序级 build.gradle ;
中使用以下版本解决了该问题// Google Firebase
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
答案 10 :(得分:1)
这解决了我的问题。因此,您可以尝试一下。添加
googleServices { disableVersionCheck = true }
到app \ build.gradle
答案 11 :(得分:1)
我使用这些firebase依赖项对'com.google.firebase:firebase-iid发生了类似的错误:
添加后
它消失了。
答案 12 :(得分:0)
如果升级所有com.google.firebase
库不能解决问题,请尝试升级com.google.gms:google-services
上的google services插件依赖项。
答案 13 :(得分:0)
我遇到了同样的问题。通过从https://firebase.google.com/support/release-notes/android
更新最新的Firebase消息发布版本解决了该问题来自
实现'com.google.firebase:firebase-messaging:19.0.0'
到
实现'com.google.firebase:firebase-messaging:19.0.1'
我不知道为什么突然出现构建错误。似乎很奇怪,但是当我更新firebase-messaging版本时,问题解决了。
答案 14 :(得分:0)
集成“ firebase-analytics”时遇到相同的问题。
原始代码:
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-analytics:17.0.0'
通过代码解决:
implementation 'com.google.firebase:firebase-core:16.0.4 '
implementation 'com.google.firebase:firebase-analytics:16.0.0'
将'firebase-analytics'
的版本更改为与'firebase-core'
相同的级别
答案 15 :(得分:0)
firebase消息传递的版本本质上是正确的,但是以防万一人们看到这种情况,我建议看到Current Android Release Notes以使您的所有firebase库保持最新。
问题是,如果您实现了一个需要其他Firebase库才能运行的库,并且添加了第二个具有相同依赖关系但在更高版本上运行的库,则会失去兼容性。
截至目前,Google在不发布新库的破坏性版本或不兼容版本方面取得了很大的进步。使用最新的版本,就可以了。
答案 16 :(得分:0)
我更新了我的Firebase消息传递版本,它解决了我的问题。
之前
implementation 'com.google.firebase:firebase-messaging:17.6.0'
已更新
implementation 'com.google.firebase:firebase-messaging:20.0.1'
答案 17 :(得分:0)
当我从Android Studio助手设置FCM android客户端时,以某种方式仅在gradle文件中添加了一些旧版本的fcm,我从android开发人员网站本身复制了粘贴的最新版本,然后错误消失了在其自己的。希望这可以帮助面临类似问题的人。
答案 18 :(得分:-1)
添加最新的cordova-android平台(v8.0.0)
添加我的这个插件的分支
添加插件以在项目中启用AndroidX
添加插件以修补现有插件源
这是100%有效的
答案 19 :(得分:-1)
此错误已通过答案为我解决
Android design support library for API 28 (P) not working
但是,后来它产生了一系列错误,这些错误在一个接一个地解决之后再次循环。后来,经过几个周期。一段时间后,我已经完成清理,使缓存无效并重新启动Android Studio,清理,gradle同步,构建,清理,重建,清理....
最后,我所做的最终更改仅是实现上述答案。
Android Stuido真的很奇怪