我在更新到最新的支持库版本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

什么好主意吗?


当前回答

在android studio,右键单击项目(因为我有一个Cordova项目,我有CordovaLib和android:在我的情况下,我选择了android),

选择开放模块设置 在弹出的项目结构模式中,在侧面板的模块部分选择项目(在我的例子中还是android) 单击Dependencies选项卡 点击右上角的绿色加号按钮 选择库依赖关系 从下拉菜单中选择app-compat-v7 清理项目和重建

其他回答

我也遇到过这个问题,你只需要做2个改变:

文件名称:android/build。Gradle在下面的代码中提到这一点

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

文件名称:android/app/build.gradle 像这样修改你的complesdk版本和buildToolVersion:

compileSdkVersion 26 buildToolsVersion "26.0.2"

而在

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

我最近碰到过这个,记得它是怎么来的。这是xamarin和android的不匹配。*版本和已安装的Android SDK版本。

当前VS2017 15.5.3新项目默认为nuGet Xamarin.Android。*为25.4.0.2,用于跨平台开发的默认VS安装是以下Android SDK包:

Android 7.1 -牛轧糖 Android SDK平台25 谷歌APIs Intel x86 Atom系统镜像

如果你升级了你的解决方案nuGet Xamarin.Android。*到26.1.0.1,那么你需要在Android SDK中安装以下软件:

安卓8.0 -奥利奥 Android SDK平台26 谷歌APIs Intel x86 Atom系统镜像

我对离子也有同样的问题。

cordova platform remove android
cordova platform add android@6.4.0

在platform/android/ project .properties中替换

cordova.system.library.1=com.android.support:support-v4+

To

cordova.system.library.1=com.android.support:support-v4:26+

我遇到了这个完全相同的错误,并在谷歌上到处搜索,试图找到我做错了什么,因为这是生成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的工作也很好。

改变 编译SDK版本:

compileSdkVersion 26

构建工具版本:

buildToolsVersion "26.0.1"

目标SDK版本:

targetSdkVersion 26

依赖关系:

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

内Gradle。