I have imported an Android Studio project as a library for another of my projects. My original question for that is here. It worked excellently for a while, until today. Today I finished updating my library (in its own project) and copied the new files over. I edited the settings.gradle
and build.gradle
files as I did before but I am getting the error:
Project with path 'Eed:libraries:Overt:Util' could not be found in project ':CES'.
The library's original project is structured like this:
Overt/
+ Visible/
+ Control/
+ CES/
+ Util/
In that project, CES
is dependent upon Util
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':Util')
}
When I copied the new version of Overt
over I modified the project level settings.gradle
and module level build.gradle
.
Structure:
Eed/
Eed/
libraries/
Overt/
+ Visible/
+ Control/
+ CES/
+ Util/
settings.gradle
include ':Eed'
include ':Eed:libraries:Overt:Visible'
include ':Eed:libraries:Overt:Control'
include ':Eed:libraries:Overt:Util'
include ':Eed:libraries:Overt:CES'
and build.gradle (Eed module)
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project('libraries:Overt:Visible')
compile project('libraries:Overt:Control')
compile project('libraries:Overt:Util')
compile project('libraries:Overt:CES')
}
I have played with modifying the build.gradle
in CES but cannot figure out a solution. What am I doing wrong?
If your CES project still has this dependency, then it looks fishy:
It works best if your dependency statements use the same paths as what appears in settings.gradle, to wit:
I don't know if you can build up a relative Gradle project path to refer to a sibling project at the same level as the referring project. What I mean is that CES and Util are both at the same level,
:Eed:libraries:Overt:
, what what you really want is something like what you can do in a filesystem path with../Util
, but I don't know offhand if that's possible in Gradle.It could be that if you're expecting your complex module to be able to be imported somewhere and still maintain its module relationships with relative paths, you may be asking a lot. Having said that, if it's a firm requirement, then you can look into remapping directories in settings.gradle via
projectDir
. See Gradle subproject name different than folder name for a hint on how to get started with that if you want to go that route.