【发布时间】:2015-03-12 14:23:38
【问题描述】:
我在项目中有两个模块。
- app - 那是我的应用模块
- app-base - 这是我的应用使用的 android 库模块。
当我使用构建工具 21 和 gradle android 插件 1.1.1 构建时 有以下依赖,它会失败。
compile 'com.company.android:app-base:1.0.0@aar'
我通过以下命令将 app-base aar 部署到公司 sonatype Nexus。
gradle uploadArchives
错误信息如下:
:app:processCustomAppDebugResources
Position 34:21-35 : No resource found that matches the given name: attr 'actionBarStyle'.
Position 34:21-35 : No resource found that matches the given name: attr 'actionBarStyle'.
Position 37:29-51 : No resource found that matches the given name: attr 'windowActionBarOverlay'.
Position 29:21-36 : No resource found that matches the given name: attr 'windowActionBar'.
Position 1 : Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
Position 1 : Error retrieving parent for item: No resource found that matches the given name '@style/Widget.AppCompat.ActionBar.Solid'.
Position 19:21-44 : No resource found that matches the given name: attr 'actionBarItemBackground'.
Position 7:21-31 : No resource found that matches the given name: attr 'background'.
Position 17:21-45 : No resource found that matches the given name: attr 'selectableItemBackground'.
Position 14:32-46 : No resource found that matches the given name: attr 'titleTextStyle'.
Position 7:21-31 : No resource found that matches the given name: attr 'background'.
Position 1 : Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
Position 1 : Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
:app:processCustomAppDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processCustomAppDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/service/android/default/sdk/build-tools/21.0.0/aapt'' finished with non-zero exit value 1
要成功构建它,我只需要删除相同依赖项上的@aar。
compile 'com.company.android:app-base:1.0.0'
有人能解释一下为什么会这样吗?使用 AAR 依赖与不使用有什么区别?
【问题讨论】:
-
我也有这个问题?使用remote aar的时候会报错,如果我把这个aar下载为本地文件就可以了。你解决了吗?
-
@Carl,我不确定您的问题是什么,但就我而言,我确实删除了依赖配置中的“@aar”。 “@aar”不会传播对该 AAR 模块的依赖。我想知道你是如何定义你的应用程序模块的 AAR 文件依赖关系的。
-
我正在将项目从
sub-modlue更改为依赖aar,在我们公司的maven server.so发生了这个问题。 -
@Carl,如果你定义
compile 'com.yourcompany.android:your-applib-aar:1.0.0',那么它会抛出错误? -
是的,现在我已经解决了这个问题。我只是清理了我的PC中的
.m\repository\myuseAAR,因为第一次构建使用arr有错误,之后构建将使用本地存储库。
标签: android android-gradle-plugin aapt