No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. when updating to Support Library 26.0.0
Asked Answered
D

26

216

I've got this issue while updating to the latest Support Library version 26.0.0 (https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0):

Error:(18, 21) No resource found that matches the given name: 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'.

com.android.ide.common.process.ProcessException: Failed to execute aapt

The file is from the support library:

<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>

We're using the following versions:

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

Any ideas?

Daryn answered 25/7, 2017 at 10:53 Comment(1)
it remains an issue with the newest release (26.0.1): developer.android.com/topic/libraries/support-library/…Gritty
U
315

I was able to resolve it by updating sdk version and tools in gradle compileSdkVersion 26 buildToolsVersion "26.0.1"

and support library 26.0.1 https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-1

Ure answered 25/7, 2017 at 17:36 Comment(7)
This didn't work for me. I had to upgrade the google play services to 11.2 and then the above error came, and your answer didn't help. I also upgraded all the support stuff to 26.0.1 but still no luck. Do you have any other ideas?Kolva
But updating to 26 will also have a major impact on many other things. Including notifications not working until proper Channels are created for Android 8.0 right ?Factional
@patric Its compile SDK not target SDK.Ure
If this solution dosen't work for you, check out Sam's answer below.Portuguese
Working on Xamarin, I encountered this issue after installing android.support.v7.cardview. Downloading API 26 and updating all project settings to match this version did the trick. Looking forward to @Factional 's comment to see if it will have any side effect on my devs.Fetation
What if I don`t want to update the compileSdkVersion from 25 due to a business requirement? How to get rid of this?Mclean
I went ahead and updated the compileSdkVersion to 26Mclean
U
52

Change Compile SDK Version:

compileSdkVersion 26

Build Tool Version:

buildToolsVersion "26.0.1"

Target SDK Version:

targetSdkVersion 26

Dependencies:

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+'

Sync Gradle.

Underglaze answered 19/8, 2017 at 6:50 Comment(6)
getting warning : avoid using + in version number.Chuckle
this worked for me. removed + from all to get rid of warningsChuckle
do not use +, you want to get reproducible builds and have full control on your dependencies. You don't want your app to start bugging after a new build because it quietly upgraded a lib...Speckle
You don't need to update the targetSdkVersion for this to work. Setting that to 26 will have other implications - i.e. you must make your app compatible for Android 8.0.Oldworld
in which file i must add this things can you guide @OldworldConstrict
build.gradle in the android closureOldworld
D
35

I had to change compileSdkVersion = 26 and buildToolsVersion = '26.0.1' in all my dependencies build.gradle files

Drysalter answered 26/7, 2017 at 8:26 Comment(1)
you should use a constant in gradle.properties for all your version numbers and use it in your build.gradle files: api "com.android.support:appcompat-v7:$ANDROID_COMPATIBILITY_VERSION"Speckle
H
13

In my react-native project, this error is generated in the react-native-fbsdk. Updating the react-native-fbsdk/android/build.gradle as following fixes the issue.

compileSdkVersion 26
buildToolsVersion "26.0.1"
Homemaking answered 6/12, 2017 at 14:17 Comment(1)
adding below to root build.gradle worked no need to edit the module's build.gradle file subprojects { afterEvaluate {project -> if (project.hasProperty("android")) { android { compileSdkVersion 26 buildToolsVersion '26.0.1' } } } }Amarillo
A
9

I hit this exact same error and was Googling all over trying to find what I'm doing wrong as that is generated build values-26 code and not styles that I provided. I tried everything from Gradle 4.0 to Android Studio preview 3.0 to canary channel, you name it.

I never found the answer online. In the end, I was able to go back to standard Dev Android Studio and 2.3.3 Gradle as I ended up accidentally fixing it :).

Turned out I was so focused on updating my library project that I was not noticing that the error was caused from an unused sub module (demo app) that is nested in my library project. Once I updated the sub module to match the 26 build tools and 26+ design and support libraries my problem went away.

Not sure if that is what you are seeing as well, but personally I was only updating the lib to release again so wasn't caring about the sample app module, and the error sure appeared to be related to 26 sdk which I only touched in the lib module so wasn't thinking to check the other one. So that was the problem all along for me. Hopefully that fixes you as well. I had this error in 2 library projects and it fixed it in both.

Goodluck either way and if this doesn't resolve your issue, please share what did. BTW 26.0.01 build tools and 26.1.0 design and support is where I ended up going to in the end, although 26.0.1 worked fine as well.

Aneroid answered 18/9, 2017 at 18:46 Comment(1)
It really solves the problem (if you have several modules)Settling
E
8

I had this exact error and I realized the my compileSdkVersion was set at 25 and my buildToolsVersion was set at "26.0.1".

So I just changed the compileSdkVersion to 26 and synced the Gradle. it fixed the problem for me.

EDIT: my targetSDKVersion was also set as 26

Elusion answered 7/11, 2017 at 9:27 Comment(0)
A
8

I've had a similar error for react-native-youtube & react-native-orientation.

Figured out, that the build.gradle of those Project use compileSdkVersion 23 but the Feature: android:keyboardNavigationCluster was added since api 26 (android 8).

So how to fix?

One way to fix this easily is to edit your /android/build.gradle ( !!! NOT /android/app/build.gradle) and add those code at the bottom of the file.

This allow you to force the SDK and BuildTool-Version your submodules use:

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27
                buildToolsVersion "27.0.2"
            }
        }
    }
}
Aetiology answered 8/8, 2018 at 13:48 Comment(0)
T
7

I also faced this issue you just need to make 2 changes:

File Name : android/build.gradle mention this below code

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

File Name :android/app/build.gradle change your compliesdk version and buildToolVersion like this:

compileSdkVersion 26 buildToolsVersion "26.0.2"

and in

dependencies {
    compile 'com.android.support:appcompat-v7:26.0.2'
}
Terrieterrier answered 8/12, 2017 at 7:36 Comment(0)
E
7

I had the same issue with my Ionic 2 project, all I did to resolved the issues was

  • Open "ionic_project_folder/platforms/android/project.properties"
  • Change target=android-25 to target=android-26
  • Run ionic build --release android

Hope this helps someone!

Easel answered 19/12, 2017 at 18:19 Comment(1)
My project change to target=android-26 , but still showing this errorAdenectomy
B
6
//Adding this to the root build.gradle solved my problem, thanks @Yalamber
subprojects {
        afterEvaluate { project ->
            if (project.hasProperty("android")) {
                android {
                    compileSdkVersion 26
                    buildToolsVersion '26.0.2'
                }
            }
        }
    }
Busse answered 7/12, 2017 at 7:0 Comment(3)
can you share more information with code for more understanding of your answer.Knopp
Usually it's better to explain a solution instead of just posting some rows of anonymous code. You can read How do I write a good answer, and also Explaining entirely code-based answersAfb
Thank you! Best answer. Essentially the project dependencies (node_modules projects) had differing sdk versions. Adding this code to the root level build.gradle ensures all these dependencies use the specified sdk version and the project is able to build. :DViolate
M
4

After updating your android studio to 3.0, if this error occurs just update the gradle properties, these are the settings which solved my issue:

compileSdkVersion 26

targetSdkVersion 26

buildToolsVersion '26.0.2'
Machicolate answered 7/11, 2017 at 3:34 Comment(1)
26.0.2 build version fixed things for me.Measurement
M
3

I updated my project app/build.gradle to have

compileSDkVersion 26
buildToolsVersion '26.0.1'

However, the problem was actually with the react-native-fbsdk package. I had to change the same settings in node_modules/react-native-fbsdk/android/build.gradle.

Measurement answered 18/12, 2017 at 11:47 Comment(0)
T
3

In android studio,
right click on the project (since I had a Cordova project, I had CordovaLib and android: I selected android in my case),

  1. Select Open Module Settings
  2. In the Project Structure modal that pops up select the project in the modules section in the side panel (again android in my case)
  3. Click on the Dependencies tab
  4. Click on the green plus button in the top right corner
  5. Select Library Dependency
  6. Select app-compat-v7 from the dropdown
  7. Clean project and rebuild
Transfinite answered 21/3, 2018 at 11:10 Comment(1)
This is a much easier way of fixing this than manually editing all of the files.Intelligible
P
2

I was facing the same issue for one of my PhoneGap project (Android studio 3.0.1). To resolve this I have followed, the following step

1) Right click on Project name (In my Case android), select "Open Module Settings"

2) Select modules (android and CordovaLib)

3) Click properties on top

4) Chose Compile SDK version (I have chosen API 26: Android 8.0 )

5) Choose Build Tools Version (I have chosen 26.0.2)

6) Source Compatibility ( 1.6)

7) Target Compatibility ( 1.6)

Click Ok and rebuild project.

The following link shows my setting for step I have followed

https://app.box.com/s/o11xc8dy0c2c7elsaoppa0kwe1d94ogh https://app.box.com/s/ofdcg0a8n0zalumvpyju58he402ag1th

Planarian answered 18/12, 2017 at 8:35 Comment(0)
F
2

I hit this recently and remember where it comes from. It's a mismatch between the Xamarin.Android.* version and the installed Android SDK version.

The current VS2017 15.5.3 new project defaults for nuGet Xamarin.Android.* are 25.4.0.2 and the default VS install for cross platform development are the following Android SDK packages:

  • Android 7.1 - Nougat
    • Android SDK Platform 25
    • Google APIs Intel x86 Atom System Image

If you upgraded you solution nuGet for Xamarin.Android.* to 26.1.0.1 then you will need to install the follow in the Android SDK:

  • Android 8.0 - Oreo
    • Android SDK Platform 26
    • Google APIs Intel x86 Atom System Image
Fiden answered 16/1, 2018 at 20:31 Comment(0)
D
2

when you try to change targetSDKVersion 26 to 25 that time occurred i was found solution of No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. when updating to Support Library 26.0.0

Just Chage This code from Your Build.gradle

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.1'
            }
        }
    }
}

to

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.2.0'
            }
        }
    }
}
Doan answered 19/5, 2018 at 6:26 Comment(0)
S
2

I got this issue when compile react-native-fbsdk

I resolved this issue by change build.gradle of react-native-fbsdk

from

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

to

compile('com.facebook.android:facebook-android-sdk:4.28.0')
Saboteur answered 26/6, 2018 at 4:42 Comment(0)
P
1

This issue was caused by one of the libraries for me that needed version 26 for compilation.

Making the targetSdkVersion to 26 will cause other issues and you will have to tweak your app to adapt to the Oreo platform. This is not the correct solution for all.

Just making the compileSdkVersion to 26 and buildToolsVersion to 26.0.2 worked for me.

One should also update all of their support libraries to use 26.1.0 or later.

Proletarian answered 14/11, 2017 at 16:59 Comment(0)
B
1

update these in gradle

compileSdkVersion 27 buildToolsVersion '27.0.1'

Binnacle answered 6/12, 2017 at 6:36 Comment(0)
G
1

I resolved this issue by making some changes in build.gradle file

Changes in root build.gradle are as follows:

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

Changes in build.gradle are as follows:

compileSdkVersion 26 
buildToolsVersion "26.0.1"

and

dependencies {
    compile 'com.android.support:appcompat-v7:26.0.1'
}
Gadmon answered 30/12, 2017 at 10:35 Comment(0)
I
1

For anyone using nativescript and facing this issue: you can add

compileSdkVersion 26
buildToolsVersion '26.0.1'

in App_Resources/Android/app.gradle (under android {)

Then run tns platform remove android and tns build android in your project root.

Indentation answered 24/1, 2018 at 7:15 Comment(0)
R
0

Make sure you have Android SDK 8.0 on your development environment. I was having the same issue on my MAC and installing SDK 8.0 and its tools fixed it. I am having the same issue on Windows. I am downloading the SDK now.

Reliquary answered 20/11, 2017 at 17:26 Comment(0)
C
0

i had the same issue with ionic .

cordova platform remove android
cordova platform add [email protected]

And replace in platform/android/projet.properties

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

To

cordova.system.library.1=com.android.support:support-v4:26+
Cushat answered 22/3, 2018 at 9:48 Comment(0)
S
0

For this you have to do below things 1.right click the project click.

2.open module settings->in properties tab->change the compile sdk and build tool version into 26,26.0.0.

3.click ok.

Its working for me after an hour tried.

Selfassurance answered 29/5, 2018 at 15:17 Comment(0)
A
0

I solved this problem by doing the following:

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'
Alas answered 12/1, 2019 at 17:7 Comment(1)
Please only use English on this site. If you prefer to use Portuguese, there is Stack Overflow em Português.Hass
M
-1

Just clear your project and build again.

./gradlew  app:clean app:assembleDebug

But it not works when targetSdkVersion or compileSdkVersion is 25.

Mortensen answered 25/7, 2017 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.