简体   繁体   English

编译gradle库项目失败

[英]compile gradle library project fails

My project structure looks like this: 我的项目结构如下:

-project
--settings.gradle
--build.gradle
--src

--libA
 ---src
---build.gradle

--libB
---src
---build.gradle

--libC
----build.gradle

Main build.gradle has this dependencies: 主build.gradle具有以下依赖关系:

dependencies {

    compile project('libA')
    compile project('libB')
    compile project('libC')
}

LibA LibB and LibC are library project. LibA LibB和LibC是图书馆项目。 The problem: LibraryC depends on LibraryA and Library B. When I compile I get errors that Library C cannot find symbols of Library A or B. When I try to add this to build.gradle of LibC 问题:LibraryC依赖于LibraryA和LibraryB。编译时出现错误,提示Library C无法找到Library A或B的符号。当我尝试将其添加到build.gradle时

compile project('libA')

I get an error that the path is not found. 我收到一条找不到该路径的错误消息。 I did not find a way to specify a path if both project are on the same sub hierarchy. 如果两个项目都在同一子层次结构上,我没有找到指定路径的方法。

libC/build.gradle needs to have: libC/build.gradle需要具有:

dependencies {
    compile project(":libA")
    compile project(":libB")
}

":libA" is an absolute project path. ":libA"是绝对项目路径。 The leading ":" denotes the root project. 前导":"表示根项目。

In most cases, the root project doesn't have any source code, and doesn't declare any dependencies. 在大多数情况下,根项目没有任何源代码,也没有声明任何依赖关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM