我目前正在尝试在我的项目中添加https://github.com/firebase/FirebaseUI-Android的本地克隆作为依赖项。我不想通过标准方式导入它,因为我想对FirebaseUI进行修改。目前我正在尝试这个:
settings.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还是我的问题?
答案 0 :(得分:1)
mavenLocal()
repo:git clone https://github.com/firebase/FirebaseUI-Android
cd FirebaseUI-Android
gradlew tasks
//您会看到publishToMavenLocal
FirebaseUI-Android
打开到Intellij gradlew publishToMavenLocal
mavenLocal()
添加到您的repositories
compile 'com.firebaseui:firebase-ui:0.4.1'
执行dependencies
毕竟,你很高兴。
gradlew publishToMavenLocal
答案 1 :(得分:0)
问题在于$rootDir
的含义。如果您尝试仅构建firebase代码,则其父$ rootDir将返回其父文件夹。并且constants.gradle的相对位置有效。
现在,当您将firebase添加为项目的子项目时,$ rootDir现在是您的根目录,$rootDir/common/constants.gradle
不再是有效路径。您可以通过以下方式取消路径:
$rootDir../FirebaseUI/common/constants.gradle
但是,除非您对firebase代码进行本地更改,否则我会建议Jared建议使用maven repo中的二进制依赖项。