如何将 firebase 导入 app 模块以外的模块?

How to import firebase into a module other than the app module?

我想制作一个带有单独数据模块的多模块应用程序。我可以在普通的 kotlin 模块中导入 firebase 吗?如果不能,我应该如何修改我的数据模块才能将 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' 和模块的 gradle 文件的 android 块。 (基本上我必须将我的 kotlin 库转换为 android 库)