0

I am getting the following error when I build my app targeting API 23

AAPT: error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.

and a list of error like :

/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:3217: error: resource android:attr/textFontWeight not found.

The app builds on API level 29 but I need it to work on API 23 precisely so changing the API version is not an option. is there any way I could use an old layout maybe ? the app does not need to be pretty at all, it just needs to work.

edit : I added the following line : implementation 'com.google.android.material:material:1.2.1' to build.grade (:app) in hope that the library would provide the resources but it did not work

but I might have added it wrong

JGauthier
  • 261
  • 3
  • 6

1 Answers1

1

android:style/TextAppearance.Material.Widget.Button.Borderless.Colored was added in API 24, so when building for devices with 23 you are getting this error. solution will be to implement MaterialComponents library, which will allow you to use newer styles/widgets on older devices. look for View which is causing your problem and replace it with above library or set compat style

snachmsm
  • 17,866
  • 3
  • 32
  • 74
  • thanks, I tried it and it changed something. I edited the post – JGauthier Oct 13 '20 at 14:44
  • 1
    you've imported it right, but it won't bring you exactly same theme name - this would be naming conflict on newer devices. all built-in attributes are starting with `android:` prefix, those from libraries (or local custom) won't have this prefix. you may try to remove `android:` keeping rest (starting `style/TextAppearance...`), but I doubt it work, you have to read some doc and look for equivalent with changed naming, e.g. `.Material.` part may change to `.MaterialCompat.` (and use it without `android:` prefix also) – snachmsm Oct 14 '20 at 05:41
  • that is very useful information thank you, i'll try to check for non android: resources – JGauthier Oct 14 '20 at 22:19