同步“com.google.firebase:firebase-analytics@17.2.2”时生成错误

Posted

技术标签:

【中文标题】同步“com.google.firebase:firebase-analytics@17.2.2”时生成错误【英文标题】:Build error while syncing 'com.google.firebase:firebase-analytics@17.2.2' 【发布时间】:2020-05-10 00:09:56 【问题描述】:

我正在为崩溃报告添加 Firebase 分析。虽然同步我得到以下错误

ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an 
exact version (e.g. "[17.1.1]", but isn't being resolved to that version. Behavior exhibited by the 
library will be unknown. Dependency failing: com.google.firebase:firebase-messaging:17.5.0 -> 
com.google.firebase:firebase-iid@[17.1.1], but firebase-iid version was 20.0.2.The following 
dependencies are project dependencies that are direct or have transitive dependencies that lead to 
the artifact with the issue.

-- Project 'app' depends onto com.google.firebase:firebase-config@16.4.0
-- Project 'app' depends onto com.google.firebase:firebase-messaging@17.5.0
-- Project 'app' depends onto com.google.firebase:firebase-analytics@17.2.2
-- Project 'app' depends onto com.google.firebase:firebase-messaging@strictly 17.5.0
-- Project 'app' depends onto com.google.firebase:firebase-config@strictly 16.4.0
-- Project 'app' depends onto com.google.firebase:firebase-iid@strictly 20.0.2       
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@strictly 17.2.2
-- Project 'app' depends onto com.google.firebase:firebase-analytics@strictly 17.2.2

【问题讨论】:

确保您的依赖项彼此都是最新的。你使用的很多东西都很旧。 firebase.google.com/support/release-notes/android 当我添加所有 firebase 依赖项的最新版本时,FirebaseInstanceIdService 错误即将到来 【参考方案1】:

将您的所有 Firebase 依赖项更新到最新版本。另外更新后需要更新到androidx并使用compileSdkVersion28。

还与firebaseinstanceid相关,您需要检查以下内容:

What to use now that FirebaseInstanceId.getInstance().getToken() is deprecated

【讨论】:

以上是关于同步“com.google.firebase:firebase-analytics@17.2.2”时生成错误的主要内容,如果未能解决你的问题,请参考以下文章

区分同步代码块静态同步方法非静态同步方法的锁

rsync远程同步:下行同步上行同步+inotify实时同步

Java线程同步块行为 - 同步与同步()? [复制]

java多线程-同步块

两种同步模式:帧同步和状态同步

两种同步模式:帧同步和状态同步