1

我目前正在尝试在我的项目中添加https://github.com/firebase/FirebaseUI-Android的本地克隆作为依赖项。我不想通过标准方式导入它,因为我想对 FirebaseUI 进行修改。目前我正在尝试这个:

设置.gradle:

include ':firebaseui'
project(':firebaseui').projectDir = new File(settingsDir, '../FirebaseUI')

我的模块的build.gradle:

dependencies {
    compile project(":firebaseui")
}

但我得到:

Error:(42, 0) Could not read script 'C:\Users\Gonzalo\AndroidStudioProjects\MyProject\common\constants.gradle' as it does not exist.

在 FirebaseUI\build.gradle 中导入:

allprojects { project ->
    // Get constants, this is where we store things
    // like the list of submodules or the version
    project.apply from: "$rootDir/common/constants.gradle"
...

是 FirebaseUI 的 build.gradle 还是我的问题?

4

2 回答 2

1

通过mavenLocal()repo 使用二进制 deps:

  1. git clone https://github.com/firebase/FirebaseUI-Android
  2. cd FirebaseUI-Android
  3. gradlew tasks// 你会看见publishToMavenLocal
  4. 打开FirebaseUI-Android一个单独的 Intellij 实例
  5. 进行更改
  6. gradlew publishToMavenLocal
  7. 在您自己的项目中,添加mavenLocal()到您的repositories
  8. 然后添加compile 'com.firebaseui:firebase-ui:0.4.1'做你的dependencies

毕竟,你很高兴。

  1. 对库进行更改
  2. 通过再次发布gradlew publishToMavenLocal
  3. 重新编译您的应用程序
于 2016-06-16T14:30:04.150 回答
0

问题是什么$rootDir手段。如果您尝试仅构建 firebase 代码,则其父 $rootDir 将返回其父文件夹。并且 constants.gradle 的相对位置是有效的。

现在,当您将 firebase 添加为项目的子项目时,$rootDir 现在是您的根目录,$rootDir/common/constants.gradle不再是有效路径。您可能可以通过以下方式替换路径:

$rootDir../FirebaseUI/common/constants.gradle

但是,除非您对 firebase 代码进行本地更改,否则我会支持 Jared 的建议,即使用来自 maven 存储库的二进制依赖项。

于 2016-06-16T15:49:36.180 回答