android - 带有 AAR 的 gradle 构建失败,没有找到资源错误

标签 android android-gradle-plugin aapt

我在项目中有两个模块。

  • 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 依赖项有什么区别?

最佳答案

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

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

关于android - 带有 AAR 的 gradle 构建失败,没有找到资源错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29012363/

相关文章:

java - java按百分比随机分割uri的数组列表

gradle - Gradle uploadArchives工件的 namespace (取决于插件)

android - 强制 aapt 在构建期间重新评估原始资源

android - 使用以下命令时,Android资源链接失败:buildFeatures {viewBinding = true}

android - 如何验证 EditText 以仅在 Android 中处理数字?

java - 有什么好的安卓开发ORM工具吗?

android - 带 USB 访问的 ARC?

java - Android Studio 安装报错: supplied java-home seems to be invalid

Android Gradle - 从外部文件加载签名配置

linux - 在 shell 脚本中运行 aapt 以转储目录下所有 apk 文件的权限?