[英]How to implement Firebase on Kotlin DSL?
I'm new to Kotlin DSL.我是 Kotlin DSL 的新手。 I'm trying to migrate my current project to Kotlin DSL.
我正在尝试将我当前的项目迁移到 Kotlin DSL。 But I have one problem, I can't import firebase analytics and firebase crashlytics in my code.
但是我有一个问题,我无法在我的代码中导入 firebase 分析和 firebase crashlytics。
Here how I implemented firebase on project: gradle.build.kts (app)在这里,我如何在项目上实现 firebase:gradle.build.kts (app)
plugins {
...
id("com.google.firebase.crashlytics")
id("com.google.firebase.firebase-perf") }
dependencies{
...
val firebaseVersion = "17.3.0"
implementation("com.google.firebase:firebase-core:$firebaseVersion")
implementation("com.google.firebase:firebase-analytics:$firebaseVersion")
implementation("com.google.firebase:firebase-crashlytics:$firebaseVersion")
implementation("com.google.firebase:firebase-perf:19.0.10")}
gradle.build.kts ( level project ) gradle.build.kts(级别项目)
dependencies {
classpath(Gradle.firebaseCrash)
classpath(Gradle.firebasePlugin) }
//this is on buildSrc module const val firebaseCrash = "com.google.firebase:firebase-crashlytics-gradle:2.3.0" const val firebasePlugin ="com.google.firebase:perf-plugin:1.3.1" //这是在 buildSrc 模块上 const val firebaseCrash = "com.google.firebase:firebase-crashlytics-gradle:2.3.0" const val firebasePlugin ="com.google.firebase:perf-plugin:"
After building session, then an error comes from my class构建 session 后,我的 class 出现错误
anyone knows how to implementing it in a good way?任何人都知道如何以一种好的方式实施它? I've searched for other resources but I still got nothing.
我已经搜索了其他资源,但仍然一无所获。 Thanks:)
谢谢:)
First of all, you are using ParametersBuilder which is a part of firebase-analytics-ktx
artifact, so you need to include that in your dependencies.首先,您使用的是作为
firebase-analytics-ktx
工件的一部分的ParametersBuilder ,因此您需要将其包含在您的依赖项中。
Also, I'd recommend to follow the documentation on how to set up the sdk.另外,我建议您遵循有关如何设置 sdk的文档。 In particular the recommended way now is to use bom.
特别是现在推荐的方法是使用 bom。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.