我想制作一个带有独立数据模块的多模块应用。我可以在纯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来解决我必须添加的问题:apply plugin: 'com.android.library'
和apply plugin: 'kotlin-android'
,以及android
块到模块的gradle文件。 (基本上我必须将我的kotlin库转换为android库)