与HoloEverywhere相关的Gradle项目依赖项

时间:2013-09-21 19:02:06

标签: android gradle

我有这个目录结构:

Project
    contrib/
        holo-everywhere
            library
            addons/
                slider
                preferences
    app-library
    app-one
    app-two
    settings.gradle

我的settings.gradle看起来像这样

include 'contrib:holo-everywhere:library'
include 'contrib:holo-everywhere:addons:preferences'
include 'contrib:holo-everywhere:addons:slider'
include 'app-library'
include 'app-one'
include 'app-two'

contrib:holo-everywhere:addons:preferences取决于contrib:holo-everywhere:library

dependencies {
  compile project(':contrib:holo-everywhere:library')
}

contrib:holo-everywhere:library已成功构建,当contrib:holo-everywhere:addons:preferences正在构建时,我得到一些不明确的错误。

:contrib:holo-everywhere:addons:preferences:compileLint
:contrib:holo-everywhere:addons:preferences:copyReleaseLint UP-TO-DATE
:contrib:holo-everywhere:addons:preferences:mergeReleaseProguardFiles UP-TO-DATE
:contrib:holo-everywhere:addons:preferences:packageReleaseAidl UP-TO-DATE
:contrib:holo-everywhere:addons:preferences:preBuild UP-TO-DATE
:contrib:holo-everywhere:addons:preferences:preReleaseBuild UP-TO-DATE
:contrib:holo-everywhere:addons:preferences:preDebugBuild UP-TO-DATE
:contrib:holo-everywhere:addons:preferences:preTestBuild UP-TO-DATE
:contrib:holo-everywhere:addons:preferences:prepareMdAndroidContribHoloEverywhereLibraryUnspecifiedLibrary FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':contrib:holo-everywhere:addons:preferences:prepareMdAndroidContribHoloEverywhereLibraryUnspecifiedLibrary'.
> File '/home/project/contrib/holo-everywhere/library/build/libs/library.aar' specified for property 'bundle' does not exist.

我有点觉得问题就在这里:

dependencies {
  compile project(':contrib:holo-everywhere:library')
}

这是定义依赖的正确方法吗?

更新: 添加holo-everywhere build.gradle内容。

buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
  }
}

allprojects {
  group = 'org.holoeverywhere'
  version = '2.0.0-SNAPSHOT'

  repositories {
    mavenLocal()
    mavenCentral()
    maven {
      url "https://github.com/Prototik/HoloEverywhere/raw/repo"
    }
  }

  tasks.withType(Compile) {
    options.encoding = "UTF-8"
  }
}

apply plugin: 'android-reporting'

3 个答案:

答案 0 :(得分:1)

有些人在allprojects部分使用android-plugin时使用的版本号为reported a similar problem。可能是该插件中的错误。尝试删除版本以查看它是否发生了任何变化。

答案 1 :(得分:0)

此设置适用于gradle 2.2.1,但不适用于androidstudio 1.0.2(尚未)

project / settings.gradle(定义属于项目的模块):

include 'contrib/holo-everywhere/library'
include 'contrib/holo-everywhere/addons/preferences'
include 'contrib/holo-everywhere/addons/slider'
include 'app-library'
include 'app-one'
include 'app-two'

如果你想在project / app-one / build.gradle中使用contrib / holo-everywhere / library

替换

dependencies {
  compile project(':contrib:holo-everywhere:library')
}

dependencies {
  compile project('library')
}

您可以使用

进行测试
cd \path\to\Project
gradlew --gui

不幸的是,这在settings.gradle(使用gradle 2.2.1)

中不起作用
include '../commonLibraries/mylib'

AndroidStudio-gui和gradle-gui可以解释但不能编译这个

project / settings.gradle(定义属于项目的模块):

include 'contrib:holo-everywhere/library'
include 'contrib:holo-everywhere/addons/preferences'
include 'contrib:holo-everywhere/addons/slider'
include 'app-library'
include 'app-one'
include 'app-two'

项目/应用酮/的build.gradle

dependencies {
  compile project('library')
  compile project('library')
  compile project('preferences')
  compile project('slider')
  compile project('app-library')
}

答案 2 :(得分:0)

我的项目遇到了同样的问题,当我意识到我的AAR文件不在他们应该的文件夹中时,我解决了。所以我将丢失的AAR文件添加到各自的文件夹中。

在切换分支时,AAR文件没有被忽略,所以我试图 gradlew build 项目没有成功。