4

我有一个这样的项目布局:

MyProject/
    Project/
        build.gradle
    build.gradle
    settings.gradle
thirdparty/
    ActionBarSherlock/
        actionbarsherlock/
            build.gradle
        build.gradle
        settings.gradle

ActionBarSherlock目录是一个 git 子模块,指向devActionBarSherlock 的分支,其中包含 gradle 构建文件。

MyProject/settings.gradle我补充说:

include '..:thirdparty:ActionBarSherlock:actionbar'

MyProject/build.gradle补充说:

compile '..:thirdparty:ActionBarSherlock:actionbar'

到该dependencies部分。当我构建MyProject/Project时,gradle assemble出现以下错误:

> Project with path '..:thirdparty:ActionBarSherlock:actionbar' could not be found in project ':MyProject'

我可以ActionBarSherlock单独构建,使用:

cd thirdparty/ActionBarSherlock/actionbarsherlock
gradle assemble
cp build/libs/actionbarsherlock-4.3.2-SNAPSHOT.aar ../../../MyProject/Project/libs

然后在asdependencies部分使用它MyProject/build.gradle

compile files('libs/actionbarsherlock-4.3.2-SNAPSHOT.aar')

现在,当我构建时,出现MyProject/Project以下错误:

> Duplicate files at the same path inside the APK: AndroidManifest.xml
4

1 回答 1

2

这个谷歌小组有一个来自 Android SDK 开发者 Xavier Ducrohet 的答案。 https://groups.google.com/forum/#!topic/adt-dev/bPY_Un8BsBY

去引用:

要依赖主项目根文件夹之外的 gradle 项目,您可以尝试执行以下操作:

包括“腹肌”

project(':abs').projectDir = new File('/some/path/relative/or/absolute')

请注意,您的应用程序应该使用 project(':abs') 进行依赖,因为无论磁盘路径是什么,gradle 路径都是 :abs。

于 2013-06-17T19:20:33.183 回答