Android app : Resource not found when building with an older API

603 Views Asked by At

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

1

There are 1 best solutions below

3
snachmsm On

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