我在更新到最新的支持库版本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 清理项目和重建

其他回答

为此你必须做下面的事情 1.右击项目单击。

2.打开模块设置->属性选项卡->修改编译SDK和构建工具版本为26,26.0.0。

3.单击ok。

试了一个小时后,它为我工作了。

我在编译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')

我更新了我的项目app/build。Gradle有

compileSDkVersion 26
buildToolsVersion '26.0.1'

然而,问题实际上出在react-native-fbsdk包上。我不得不在node_modules/react-native-fbsdk/android/build.gradle中更改相同的设置。

在gradle中更新这些

compileSdkVersion 27 buildToolsVersion 27.0.1”

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

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