我在更新到最新的支持库版本26.0.0 (https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0):

错误:(18,21)没有找到与给定名称匹配的资源:attr “android: keyboardNavigationCluster”。

/.../app/build/intermediates/res/merged/beta/debug/values-v26/values-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'.
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'.
Error:Execution failed for task ':app:processBetaDebugResources'.

process. processexception: Failed to execute aapt

该文件来自支持库:

<style name="Base.V26.Widget.AppCompat.Toolbar" parent="Base.V7.Widget.AppCompat.Toolbar">
    <item name="android:touchscreenBlocksFocus">true</item>
    <item name="android:keyboardNavigationCluster">true</item>
</style>

我们正在使用以下版本:

ext.COMPILE_SDK_VERSION = 26
ext.BUILD_TOOLS_VERSION = "26.0.1"

ext.MIN_SDK_VERSION = 17
ext.TARGET_SDK_VERSION = 26
ext.ANDROID_SUPPORT_LIBRARY_VERSION = "26.0.0"
ext.GOOGLE_PLAY_SERVICES_LIBRARY_VERSION = "11.0.2"

compile 'com.android.support:appcompat-v7:' + ANDROID_SUPPORT_LIBRARY_VERSION
compile 'com.android.support:design:' + ANDROID_SUPPORT_LIBRARY_VERSION
compile 'com.android.support:recyclerview-v7:' + ANDROID_SUPPORT_LIBRARY_VERSION

什么好主意吗?


当前回答

对于任何使用nativescript并面临此问题的人:您可以添加

compileSdkVersion 26
buildToolsVersion '26.0.1'

在App_Resources / Android应用程序。Gradle(在android{下)

然后运行tns平台删除android和tns构建android在你的项目根。

其他回答

我通过在构建中做一些更改来解决这个问题。gradle文件

根构建的更改。Gradle如下:

subprojects {
   afterEvaluate { 
     project -> if (project.hasProperty("android")) { 
       android { 
        compileSdkVersion 26 
        buildToolsVersion '26.0.1' 
       } 
      }
    } 
}

构建的变化。Gradle如下:

compileSdkVersion 26 
buildToolsVersion "26.0.1"

and

dependencies {
    compile 'com.android.support:appcompat-v7:26.0.1'
}

在更新你的android studio到3.0后,如果出现这个错误,只需更新gradle属性,这些是解决我的问题的设置:

compileSdkVersion 26

targetSdkVersion 26

buildToolsVersion '26.0.2'

我遇到了这个完全相同的错误,并在谷歌上到处搜索,试图找到我做错了什么,因为这是生成build values-26代码,而不是我提供的样式。我尝试了从Gradle 4.0到Android Studio预览3.0再到金丝雀频道,应有尽有。

我从来没有在网上找到答案。最后,我能够回到标准的Dev Android Studio和2.3.3 Gradle,因为我最终意外地修复了它:)。

原来我是如此专注于更新我的库项目,我没有注意到错误是由一个未使用的子模块(演示应用程序)嵌套在我的库项目中引起的。一旦我更新了子模块以匹配26个构建工具和26+设计和支持库,我的问题就消失了。

不确定这是否是你所看到的,但就我个人而言,我只是更新了lib再次发布,所以不关心样本应用程序模块,错误肯定似乎与26 sdk有关,我只在lib模块中接触过,所以没有考虑检查另一个。这就是我一直以来的问题。希望这也能解决你的问题。我在2个图书馆项目中有这个错误,它在两个项目中都修复了它。

祝你好运,如果这不能解决你的问题,请分享是什么解决了。BTW 26.0.01的构建工具和26.1.0的设计和支持是我最终选择的,尽管26.0.1的工作也很好。

我在编译react-native-fbsdk时得到了这个问题

我通过更改构建解决了这个问题。react-native-fbsdk的Gradle

compile('com.facebook.android:facebook-android-sdk:4.+')

to

compile('com.facebook.android:facebook-android-sdk:4.28.0')

我通过以下方法解决了这个问题:

compileSdkVersion 26
buildToolsVersion "26.0.1"

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