8

So after been away from my Android Studio project for a while I ran all updates.

My build gradle defines this

compileSdkVersion 23

buildToolsVersion '23.0.1'

However, now when I rebuild all I get error:

W:\android-studio-projects\sharedid\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

Here's the file - not one I have created:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored" parent="android:TextAppearance.Material.Widget.Button.Borderless.Colored"/>
    <style name="Base.TextAppearance.AppCompat.Widget.Button.Colored" parent="android:TextAppearance.Material.Widget.Button.Colored"/>
    <style name="TextAppearance.AppCompat.Notification.Info.Media"/>
    <style name="TextAppearance.AppCompat.Notification.Media"/>
    <style name="TextAppearance.AppCompat.Notification.Time.Media"/>
    <style name="TextAppearance.AppCompat.Notification.Title.Media"/>
</resources>

The thing I do no understand here - this error seems to stem from a problem in Android libraries themselves - and not related directly to my code.

Since my compile SDK and build versions have not changed - how can I suddenly start getting this error? And how do I solve it?

Tom
  • 3,587
  • 9
  • 69
  • 124
  • 1
    tried to clean and manually delete all your build folders? – firegloves Jan 06 '17 at 12:22
  • 1
    Just covering the usual bases - Are you building from clean, and have you invalidated the caches in Android Studio? – Michael Dodd Jan 06 '17 at 12:22
  • 1
    http://stackoverflow.com/questions/26431676/appcompat-v721-0-0-no-resource-found-that-matches-the-given-name-attr-andro#26449172 – sivaBE35 Jan 06 '17 at 12:28
  • @firegloves and michael - I have tried renaming folders in W:\android-studio-projects\sharedid\build, then "clean" then "rebuild project" – Tom Jan 06 '17 at 13:13
  • @siva somehow it helped changing buildToolsVersion ,targetSdkVersion, compileSdkVersion to 25 (and downloading v25 of buildToolsVersion) - not entirely sure why - I guess maybe because 'com.android.support:support-v4' use v25? – Tom Jan 06 '17 at 13:29
  • 1
    v7 includes the v4 support library so there is no need to have it in there again if you look in the libs folder of the v7 support library you will see that the v4 jar is already referenced in the library Remove V4. – sivaBE35 Jan 06 '17 at 14:35
  • Possible duplicate of [Output: error: resource style/TextAppearance.Compat.Notification.Info (aka package\_name:style/TextAppearance.Compat.Notification.Info) not found](https://stackoverflow.com/questions/50323729/output-error-resource-style-textappearance-compat-notification-info-aka-packa) – Carl Anderson Jul 10 '19 at 16:46

4 Answers4

16

I had similar problem and fixed it by overriding the offending style. This workaround lets you build projects with a build.gradle file containing API 23 with 23.x.x support libraries:

compileSdkVersion 23
buildToolsVersion "23.0.3"
targetSdkVersion 23

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

Create res\values-v24\styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
    <style name="Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored" parent="android:TextAppearance.Material.Widget.Button" tools:override="true" />
    <style name="Base.TextAppearance.AppCompat.Widget.Button.Colored" parent="android:TextAppearance.Material.Widget.Button" tools:override="true" />
</resources>
Veener
  • 4,771
  • 2
  • 29
  • 37
6

You might want to check you compileSdkVersion in your gradle settings. This needs to match your dependency import I think.

So if you are importing compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:design:25.3.1' etc.

then I think the compileSdkVersion should be 25 too.

At least thats what worked for me.

srinij
  • 471
  • 6
  • 10
0

This issue came to my project too.but the problem doesn't solve either add those 2 lines of code.(this override part was remove automatically after run the project by me)

chamzz.dot
  • 607
  • 2
  • 12
  • 24
0

I also faced the similar issue. It basically means that we still have some unaddressed error in res/values folder. So look out for errors in the files inside res/values starting with styles.xml.

Amit
  • 3,422
  • 3
  • 28
  • 39