解决Android错误:No resource found that matches the given name: attr 'android:keyboardNavigationCluster'

时间:2022-06-01 19:34:24

问题

升级到Android Support Library version 26.0.0 报错:

..\build\intermediates\res\merged\debug\values-v26\values-v26.xml
Error:(5, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Error:(5, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

这个应该是Android Support Library version 26的bug,参考Issue Tracker

解决方案

buildToolVersion修改为26.0.1,各相关版本如下:

compileSdkVersion 26
buildToolsVersion "26.0.1"
targetSdkVersion 26

依赖

compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'