Android的工作室库项目的依赖关系
我导入一个Android Studio项目作为我的另一个项目库。对于我原来的问题是here.它的工作出色了一段时间,直到今天。今天我完成更新我的图书馆(在自己的项目),并在复制的新文件。我编辑了 settings.gradle
和 build.gradle
文件和我一样过,但我得到的错误:
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/
在该项目中, CES
依赖于的Util
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':Util')
}
当我复制显性
在我修改了项目一级 settings.gradle
和模块级的新版 build.gradle 。
When I copied the new version of Overt
over I modified the project level settings.gradle
and module level build.gradle
.
结构:
Eed/
Eed/
libraries/
Overt/
+ Visible/
+ Control/
+ CES/
+ Util/
settings.gradle
settings.gradle
include ':Eed'
include ':Eed:libraries:Overt:Visible'
include ':Eed:libraries:Overt:Control'
include ':Eed:libraries:Overt:Util'
include ':Eed:libraries:Overt:CES'
和build.gradle(EED模块)
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')
}
我已经打了修改 build.gradle
在CES上,但不能想出一个解决方案。我究竟做错了什么?
I have played with modifying the build.gradle
in CES but cannot figure out a solution. What am I doing wrong?
如果您的 CES 的项目仍然这种依赖性,那么它看起来可疑:
If your CES project still has this dependency, then it looks fishy:
compile project(':Util')
它的工作原理最好的,如果你的相关性语句使用相同的路径,这似乎在 settings.gradle ,即:
compile project(':Eed:libraries:Overt:Util')
我不知道你是否能建立一个相对摇篮工程路径是指兄弟姐妹项目在同一级别上参照项目。我的意思是, CES 和的Util 都处于同一水平,:EED:库:显性:
,什么是你真正想要的是一样的东西,你可以在一个文件系统路径做什么用 ../的Util
,但我不知道随便如果可能的话在摇篮。
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.
这可能是因为,如果你希望你的复杂的模块,能够在某个地方进口,仍保持相对路径及其模块的关系,你可能会问了很多。话虽如此,如果它是一个坚定的要求,那么你可以考虑重新映射目录中的 settings.gradle 通过 PROJECTDIR
。请参阅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.