Tom
Tom

Reputation: 3627

Strange error after updatng Android studio

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?

Upvotes: 8

Views: 10230

Answers (4)

Amit
Amit

Reputation: 3702

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.

Upvotes: 0

srinij
srinij

Reputation: 491

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.

Upvotes: 6

chamzz.dot
chamzz.dot

Reputation: 775

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)

Upvotes: 0

Veener
Veener

Reputation: 5191

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>

Upvotes: 16

Related Questions