“build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1”

本文解决了Android开发中出现的键盘导航集群(attr 'android:keyboardNavigationCluster')资源未找到的问题,追溯到约束布局(constraint-layout)依赖升级导致的冲突,并提供了解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天突然遇到一个问题:

C:\Users\Hzx\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\cd25e25b1ef780c5b0d840e0ab03e27b\res\values-v26\values-v26.xml
Error:(13, 5) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
F:\Git\AkeetaApp-Android\app\build\intermediates\res\merged\debug\values-v26\values-v26.xml
Error:(15, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\Hzx\AppData\Local\Android\sdk1\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\Users\Hzx\AppData\Local\Android\sdk1\platforms\android-25\android.jar -M \\?\F:\Git\AkeetaApp-Android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S F:\Git\AkeetaApp-Android\app\build\intermediates\res\merged\debug -m -J \\?\F:\Git\AkeetaApp-Android\app\build\generated\source\r\debug -F F:\Git\AkeetaApp-Android\app\build\intermediates\res\debug\resources-debug.ap_ -D \\?\F:\Git\AkeetaApp-Android\app\build\intermediates\multi-dex\debug\manifest_keep.txt --custom-package com.argrace.smart -0 apk --preferred-density xxhdpi --output-text-symbols \\?\F:\Git\AkeetaApp-Android\app\build\intermediates\symbols\debug --no-version-vectors}
Error:com.android.ide.common.process.ProcessException: Error while executing process C:\Users\Hzx\AppData\Local\Android\sdk1\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\Users\Hzx\AppData\Local\Android\sdk1\platforms\android-25\android.jar -M \\?\F:\Git\AkeetaApp-Android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S F:\Git\AkeetaApp-Android\app\build\intermediates\res\merged\debug -m -J \\?\F:\Git\AkeetaApp-Android\app\build\generated\source\r\debug -F F:\Git\AkeetaApp-Android\app\build\intermediates\res\debug\resources-debug.ap_ -D \\?\F:\Git\AkeetaApp-Android\app\build\intermediates\multi-dex\debug\manifest_keep.txt --custom-package com.argrace.smart -0 apk --preferred-density xxhdpi --output-text-symbols \\?\F:\Git\AkeetaApp-Android\app\build\intermediates\symbols\debug --no-version-vectors}
Error:org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Hzx\AppData\Local\Android\sdk1\build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

看到这个,一开始以为是包重复导致的,查了下External Libraries,发现很多v4,v7包,多了一个重复的。我build文件里,只添加了25版的,突然多了27版的,莫名其妙的多了。我查了我所有的lib,都没有发现有地方调用到27版的东西。非常奇怪。那这个27版的v7包是怎么导入到里面的呢。
原来程序里,有个这样的引用

implementation 'com.android.support.constraint:constraint-layout:+'

这个包应该是升级了,所以,它自动会引用最高版的,我此时它是升级到2.0.0版。我猜测,是2.0.0版的implementation 'com.android.support.constraint:constraint-layout:+'需要用到27版的v7包,所以自动给我程序导入了。
总结:
尽量不要使用“:+”来导入包,容易出错。

AAPT2error:checklogsfordetails解决方法
直接移步去看吧,http://blog.sina.com.cn/s/blog_5de73d0b0102yffd.html
大体是说,构建 App 的时候,打开 Build 窗口,点击 “Toggle View” 切换到文本输出。这里能看到错误的详细错误

找不到R文件Error:com.android.ide.common.process.ProcessException: Error while executing process E:\AndroidSDK\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I E:\AndroidSDK\platforms\android-26\android.jar -M \\?\E:\chapter02\FrameLayout\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S E:\chapter02\FrameLayout\app\build\intermediates\res\merged\debug -m -J \\?\E:\chapter02\FrameLayout\app\build\generated\source\r\debug -F E:\chapter02\FrameLayout\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.example.dell.framelayout -0 apk --preferred-density xxhdpi --output-text-symbols \\?\E:\chapter02\FrameLayout\app\build\intermediates\symbols\debug --no-version-vectors} Error:Execution failed for task ':app:processDebugResources'. > Failed to execute aapt Error:org.gradle.process.internal.ExecException: Process 'command 'E:\AndroidSDK\build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1 Error:(165, 31) No resource found that matches the given name (at 'layout_above' with value '@id/btn_submit'). Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process E:\AndroidSDK\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I E:\AndroidSDK\platforms\android-26\android.jar -M \\?\E:\chapter02\FrameLayout\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S E:\chapter02\FrameLayout\app\build\intermediates\res\merged\debug -m -J \\?\E:\chapter02\FrameLayout\app\build\generated\source\r\debug -F E:\chapter02\FrameLayout\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.example.dell.framelayout -0 apk --preferred-density xxhdpi --output-text-symbols \\?\E:\chapter02\FrameLayout\app\build\intermediates\symbols\debug --no-version-vectors}
最新发布
03-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值