col*_*ots 9 kotlin firebase build.gradle gradle-kotlin-dsl kmm
当我尝试在 Kotlin Multiplatform Mobile (KMM) 项目的共享模块中使用以下块添加 Firebase-bom 依赖项时,该词platform
出现在红色错误文本中,并且 Gradle 构建失败并显示“未解析的引用:平台”。我该如何解决这个问题以便正确构建?
val androidMain by getting {
dependencies {
implementation(platform("com.google.firebase:firebase-bom:28.0.1"))
implementation("com.google.firebase:firebase-analytics-ktx")
}
}
Run Code Online (Sandbox Code Playgroud)
col*_*ots 22
答案就在KT-40489中。
\nplatform()
用于导入 Firebase 物料清单的函数在 Kotlin Multiplatform plugin\xe2\x80\x99s 中不可用,但KotlinDependencyHandler
仅在 Gradle\xe2\x80\x99s standard 中可用DependencyHandler
。修复似乎也不会很快到来。因此,您需要显式指定 Gradle 的处理程序。
这里有两个解决方法:
\nval androidMain by getting {\n dependencies {\n implementation(project.dependencies.platform("..."))\n }\n}\n
Run Code Online (Sandbox Code Playgroud)\n或者
\nval androidMain by getting {\n dependencies {\n "jvmMainImplementation"(platform("...))\n }\n}\n
Run Code Online (Sandbox Code Playgroud)\n
归档时间: |
|
查看次数: |
1613 次 |
最近记录: |