Search code examples
androidandroid-studiogradlefirebaseui

Add external project in Android Studio project as dependency results in error not finding a file


I'm currently trying to add a local clone of https://github.com/firebase/FirebaseUI-Android as a dependency in my project. I don't want to import it through the standard way, because I want to make modifications to FirebaseUI. Currently I'm trying this:

settings.gradle:

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

my module's build.gradle:

dependencies {
    compile project(":firebaseui")
}

But I get:

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

which is imported in 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"
...

Is it a problem with FirebaseUI's build.gradle or mine?


Solution

  • Use binary deps via mavenLocal() repo:

    1. git clone https://github.com/firebase/FirebaseUI-Android
    2. cd FirebaseUI-Android
    3. gradlew tasks // you will see publishToMavenLocal
    4. Open FirebaseUI-Android into a separate instance of Intellij
    5. Make your changes
    6. Run gradlew publishToMavenLocal
    7. In your own project, add mavenLocal() to your repositories
    8. Then add compile 'com.firebaseui:firebase-ui:0.4.1' do your dependencies

    After all that, you are good to go.

    1. Make changes to the library
    2. Publish it again via gradlew publishToMavenLocal
    3. Re-compile your application