1. 程式人生 > >No resource found that matches the given name: attr 'android:keyboardNavigationCluster'

No resource found that matches the given name: attr 'android:keyboardNavigationCluster'

先看報錯

/…/appild/intermediates/res/merged/beta/debugalues-v26alues-v26.xml
Error:(15, 21) No resource found that matches the given name: attr ‘android:keyboardNavigationCluster’.
Error:(18, 21) No resource found that matches the given name: attr ‘android:keyboardNavigationCluster’.

Module 的執行環境

  compileSdkVersion 25
buildToolsVersion '25.0.2' defaultConfig { applicationId "com.aoben.qproj" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true
}

解決方法:

首先,我想我的程式碼和上次編譯沒有變動啊。

可能是我的引用出現了問題。

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:design:+' ................ compile 'com.squareup.retrofit2:converter-scalars:2.0.0' //======rxJav需要的引用======== compile 'io.reactivex.rxjava2:rxandroid:2.0.1' compile 'io.reactivex.rxjava2:rxjava:2.0.9' //新增.addCallAdapterFactory(RxJava2CallAdapterFactory) compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' //實現View 彈性效果 compile 'me.everything:overscroll-decor-android:1.0.4' compile 'com.takwolf.android:hf-recyclerview:0.1.1' }

用這個方法試了後,發現沒有解決問題,而且還出現了新的問題。

所以想不是這個問題。還是回到引用中,突然看到compile 'com.android.support:design:+',後面是用的+,將這裡改為對應編譯版本的具體的版本號。如compile 'com.android.support:design:25.0.0' ,這樣以來就解決了,出現問題。