android - Android:即使没有任何更改,资源链接在测试执行时也会失败
问题描述
当我对始终运行良好的发布变体执行测试时,我开始出现错误。代码始终在 Docker 容器中执行,因此我们可以确保构建始终是干净的。
今天由于某种原因,代码完全没有变化,我开始在测试运行中看到错误:
Execution failed for task:
am:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/.gradle/caches/transforms-2/files-2.1/ff28653768e2ccb1135467db3600af3a/core-1.7.0-alpha02/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
我对该错误进行了一些研究,但我只发现与另一个资源相关的错误,但没有发现关于 lStar 的错误。到目前为止,我发现 lStar 特别是添加到 Android 31(Android 12)的代码,这对我来说没有意义,如果我的 compileSdkVersion 值为 28,它为什么应该开始在 Android 12 上工作。
<declare-styleable name="ColorStateListItem">
<!-- Base color for this state. -->
<attr name="android:color"/>
<!-- Alpha multiplier applied to the base color. -->
<attr format="float" name="alpha"/>
<attr name="android:alpha"/>
<!-- Perceptual luminance applied to the base color. From 0 to 100. -->
<attr format="float" name="lStar"/>
<attr name="android:lStar"/>
</declare-styleable>
即使没有任何更改,此错误的原因可能是什么?
解决方案
我发现了问题,并且能够解决它。
问题是应用程序所依赖的外部库之一具有依赖关系,androidx.core:core-ktx:+
这意味着它始终使用最新版本进行编译。我的应用程序仍在使用 SDK 28,但最新版本androidx.core:core-ktx
的最小 SDK 为 31,这导致了此冲突。
推荐阅读
- python-3.x - 卡在 pygame.event.get()
- amazon-web-services - Amazon Connect - 无法调试获取客户输入阶段中的错误
- python - 将子进程的输出拆分为列表/数组并在列表/数组中查找特定字符串。(Python)
- vhdl - std_logic:='X' 的操作
- javascript - 如何将switch语句中的模板字符串与js匹配?
- regex - 需要将3个公式组合成1个
- angularjs - 如何检查所有和取消选中Angularjs中的所有静态复选框?
- azure - 使用 Terraform 的 Azure 数据工厂诊断设置的资源特定目标表
- if-statement - 我可以将 IF 函数的值转换为方程式吗?
- go - 如何自动使测试在包内并行运行?