我在将 Firebase 集成到我的 Flutter 项目中时遇到问题。当我在 pubspec.yaml 文件中的项目中添加 firebase_core 时,我收到两个错误。其中之一是 multidex 支持,可以修复并且没问题。但另一个是编译错误。
这是错误:
e: C:/Users/DELL/.gradle/caches/transforms-3/8c29013e1aed588339a4f98b518cda7c/transformed/jetified-play-services-measurement-api-21.6.1-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
以及以下内容:
[!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
│ update C:\Users\DELL\Desktop\newfer\android\build.gradle: │
│ ext.kotlin_version = '<latest-version>' │
请注意,我的 Kotlin 版本**较高**,可用的最新版本以及所有其他问题都是由旧的不兼容版本引起的。
一旦删除
firebase_core
,我就没有任何问题并且代码编译正确。
可能是什么问题?
提前感谢您的帮助。我已经陷入这个阶段有一段时间了。
尝试使用旧版本,对我来说它可以工作 19.0.2: “com.google.firebase:firebase-analytics-ktx:19.0.2”