Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 536
Tom Avatar asked Jan 06 '17 12:01

Tom


2 Answers

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>
like image 133
Veener Avatar answered Nov 15 '22 08:11

Veener


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.

like image 36
srinij Avatar answered Nov 15 '22 08:11

srinij