Harnick
07/18/2023, 9:25 PM| Projects
| Library
| Project
I'm attempting to import it in my settings.gradle.kts
file like so:
include(":shared", ":androidApp")
project(":Library").projectDir = file("../Library")
However when syncing I get the following error: Project with path ':Library' could not be found.
If I println
the absolute path it matches the directory I'm looking for. Can I ask what I'm doing wrong?
Android Studio is installed as a standard package (using Linux), and shouldn't have any permission issues accessing the directory.Vampire
07/18/2023, 9:58 PM:Library
without having it included first.
But, assuming you use that in multiple projects doing it like that is a biiiiig no-go anyway. Never ever ever ever ever include one project in multiple builds. Instead make Library
an own standalone build with own settings script and then use composite build (includeBuild
) to include the whole build.Harnick
07/19/2023, 3:55 PMHarnick
07/19/2023, 4:33 PMincludeBuild
?
I ask since I can't access them from my main project folder.Vampire
07/19/2023, 8:55 PMHarnick
07/20/2023, 6:55 PMincludeProject
declaration:
includeBuild("../Library") {
dependencySubstitution {
substitute(module("uk.co.harnick:Library")).using(project(":"))
}
}
And in my build.gradle file's dependencies, I changed the declaration to this:
implementation("uk.co.harnick:Library:1.0-SNAPSHOT")
I'm assuming I'm misunderstanding or have missed something.Harnick
07/20/2023, 7:12 PMkotlin.mpp.import.enableKgpDependencyResolution=true
Vampire
07/20/2023, 7:14 PMLibrary
is properly configured to publish an artifact with those coordinates, just the simple includeBuild
is necessary and no dependency substitution.
The dependency substitution is only necessary for strange edge cases, or misconfigured builds not under your control.Vampire
07/20/2023, 7:14 PMI added the following line to my project's gradle.properties file and it all works great!👌
Harnick
07/20/2023, 7:15 PMI would recommend to avoid manual dependency substitution wherever possible.Tested it without and it worked fine. I just added that previously to be doubly sure it wasn't a configuration issue. Thank you so much for your time!