我想制作一个带有单独数据模块的多模块应用程序。我可以在纯Kotlin模块中导入Firebase吗?如果不能,我应该如何修改Data模块才能将Firebase导入其中?
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.2'
}
}
plugins {
id "org.jetbrains.kotlin.jvm"
}
dependencies {
def moduleDependencies = rootProject.ext.remoteDependencies
def moduleTestDependencies = rootProject.ext.remoteTestDependencies
implementation moduleDependencies.firestore
implementation moduleDependencies.firestoreKtx
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
apply plugin: 'com.google.gms.google-services'
这是我当前在数据模块中的构建文件。目前,我可以同步和构建,但无法在模块内部导入Firebase库。
编辑:问题是我想在app模块之外的其他模块中使用firestore,但是当我在数据模块中为其添加依赖项时,我不能使用Firestore(由于未解决的引用)
问题是我试图在纯Kotlin库中使用firestore来解决我必须在模块的gradle文件中添加apply plugin: 'com.android.library'
,和apply plugin: 'kotlin-android'
以及一个android
块的问题。(基本上我必须将我的kotlin库转换为android库)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句