Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

355
Views
Gradle composite build cannot find included project dependency

I'm trying to set up a composite build. The current structure is

projectA
  -build.gradle
  -settings.gradle
  -app
    -build.gradle
projectB
  -buid.gradle
  -settings.gradle
  -sdk
    -build.gradle

I need to use projectB as a dependency in projectA, however, projectB still needs to function as a standalone project.

Here's what I have currently

ProjectA settings.gradle contains

includeBuild('../projectB')

ProjectA build.gradle contains

group "com.example"

projectA:App build.gradle contains

dependencies {
  implementation 'com.example:projectB'
}

projectB build.gradle contains

group "com.example"

However, when I try to build projectA, I get the error:

Could not resolve com.example:projectB.
 Required by:
     project :app

What am I doing wrong here? I feel like it has something to do with the 'com.example', but I can't figure out what the correct way to reference the included project as a dependency is.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You are not substituting the dependency in project A. You can refer to example 6 in this section: https://docs.gradle.org/current/userguide/composite_builds.html#included_build_declaring_substitutions

In your case, you want to modify the settings.gradle file of project A to look something like:

includeBuild('../projectB') {
    dependencySubstitution {
          substitute module("com.example:projectB") using project(':projectB')
    }
}

This will tell gradle that during the configuration phase, it should replace any dependency on com.example:projectB with project :projectB found in ../projectB.

Having said the above, it looks like you are actually interested in including the sdk module defined in projectB. If this is the case, you can replace using project(':projectB') with using project(':sdk')

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!