Android 带AAR的渐变生成失败,未找到资源错误

Android 带AAR的渐变生成失败,未找到资源错误,android,android-gradle-plugin,aapt,Android,Android Gradle Plugin,Aapt,我在项目中有两个模块 应用程序-这是我的应用程序模块 应用程序库-这是我的应用程序使用的android库模块 当我使用构建工具21和gradle android插件1.1.1构建时 使用以下依赖项,它将失败 compile 'com.company.android:app-base:1.0.0@aar' 我通过以下命令将appbaseaar部署到公司sonatypenexus gradle uploadArchives 错误消息如下: :app:processCustomAppDebug

我在项目中有两个模块

  • 应用程序-这是我的应用程序模块
  • 应用程序库-这是我的应用程序使用的android库模块
当我使用构建工具21和gradle android插件1.1.1构建时 使用以下依赖项,它将失败

compile 'com.company.android:app-base:1.0.0@aar'
我通过以下命令将appbaseaar部署到公司sonatypenexus

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依赖项与不使用AAR依赖项有什么区别?

这些参数来自Android支持库。您是否已经将Android支持库包含在依赖项列表中

compile 'com.android.support:appcompat-v7:21.0.3'

我想抓取一些东西,它是在应用程序库中声明的,而不是在应用程序模块中声明的。所以@AAR dependency使之不能从app base module传播依赖项?是的。应用程序模块从应用程序库传播依赖项,但不传播相反的依赖项。在您的例子中,您将把app-base模块编译为aar文件,因此只编译app-base模块。你也必须在app base module中声明依赖项。我也有这个问题?当使用远程aar时会出错,如果我将此aar下载为本地文件,它工作正常。你解决了吗?@Carl,我不确定你的问题是什么,但在我的情况下,我确实删除了依赖项配置中的“@aar”。“@aar”不会传播aar模块所具有的依赖项。我想知道您是如何定义应用程序模块上的AAR文件依赖关系的。我正在将项目从
sub-modlue
更改为我们公司maven服务器上的依赖关系
AAR
。所以出现了这个问题。@Carl,如果您定义
compile'com.yourcompany.android:your-applib-AAR:1.0.0'
,那么它会抛出错误吗?是的,现在我已经解决了这个问题。我只是清理了我电脑中的
.m\repository\myuseAAR
,因为第一次构建使用arr时出错,之后构建将使用本地存储库。