Karim Varela
Karim Varela

Reputation: 7652

Gradle not able to find dependencies when use build script named anything other than "build.gradle"

Gradle noobie, a little confused. I'm trying to tell gradle to use a different build script, from the command-line, but whenever I do so, it tells me it can't find my dependencies.

Whenever I call:

gradle -b build.gradle

It works fined.

But when I call:

gradle -b other.gradle

It pukes trying to find my dependencies. e.g.

* What went wrong:
A problem occurred evaluating root project '<main_app>'.
> Project with path ':facebook-android-sdk-3.0.1:facebook' could not be found in root project '<main_app>'.

I'm using the exact same build script in the exact same directory, just named differently. Here it is:

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.4.2'
    }
}

apply plugin: 'android'

dependencies {
    compile project(':facebook-android-sdk-3.0.1:facebook')
}

android {
    buildToolsVersion "17.0"
    compileSdkVersion 17

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }
}

My settings.gradle file:

include '<app_module>'
include '<:facebook-android-sdk-3.0.1:facebook>'

Upvotes: 0

Views: 791

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123890

-b only works for single-project builds. In multi-project builds, settings.gradle determines which build scripts constitute the build, which project they belong to, and where they are located.

Upvotes: 2

Related Questions