Gradle:.aar库未包含在编译器的输出中

时间:2014-09-11 09:43:54

标签: android groovy gradle android-gradle

我有一个Gradle项目,由两个子项目组成:UI和后端库。 它上面的图书馆依赖于另一个.aar图书馆。

从库的build.gradle中提取:

dependencies {
    compile(name: 'ActionBarSherlock', ext: 'aar')
}

从UI的build.gradle中提取:

dependencies {
    compile project(":my_library")
    compile fileTree(dir: 'libs', include: ['*.jar']) // all jars
}

当我尝试构建项目时,构建失败并出现以下错误:

> Could not resolve all dependencies for configuration ':UI:_debugCompile'.
   > Could not find :ActionBarSherlock:.
     Required by:
         Project:UI:unspecified > Project:my_library:unspecified

我检查了my_library的.aar输出,但ActionBarSherlock.arr文件夹中没有libs。如何告诉Gradle将.arr文件包含到库输出中?

1 个答案:

答案 0 :(得分:0)

transitive = true

似乎不见了。例如(在build.gradle UI中):

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ('com.your.company.backendlib') {
        transitive = true
    }
}