yaugenka
yaugenka

Reputation: 2871

Gradle composite build dependency substitutions do not get applied

I have an android application with a library dependency which I would like to be substituted by a local project as described in composite builds

build.gradle (Module: MyApp.app)

dependencies {
    implementation 'com.github.myname:lib_project_name:dev-SNAPSHOT'
}

settings.gradle (Project Settings)

include ':app'

includeBuild('../lib_project_name') {
    dependencySubstitution {
        substitute module('com.github.myname:lib_project_name') using project(':')
    }
}

The lib project consists of two subprojects (an example app and the lib itself)

settings.gradle (Project lib_project_name)

include ':app'
include ':lib'

After syncing project with gradle files the lib got displayed in Android Studio as subproject but gradle throughs the warning

Unable to resolve dependency for ':app@debug/compileClasspath':
Could not resolve com.github.myname:lib_project_name:dev-SNAPSHOT.

Any ideas how to solve this?

Upvotes: 1

Views: 1887

Answers (1)

yaugenka
yaugenka

Reputation: 2871

I've read the documentation more closely and found that

the composite build will substitute any dependency on [module] with a dependency on the root project of [library]

Changing using project(':') to using project(':lib') solved the problem.

Upvotes: 4

Related Questions