问题描述
构建针对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.
和类似以下错误列表:
/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:3217: error: resource android:attr/textFontWeight not found.
该应用程序在API级别29上构建,但我需要它在API 23上正常工作,因此更改API版本不是一种选择。 有什么办法可以使用旧版面吗?该应用程序根本不需要漂亮,它只需要正常工作即可。
编辑:
我添加了以下行:
implementation 'com.google.android.material:material:1.2.1'
进行build.grade(:app),希望该库可以提供资源,但无法正常工作
解决方法
android:style/TextAppearance.Material.Widget.Button.Borderless.Colored
已在API 24中添加,因此在为23版本的设备进行构建时会遇到此错误。解决方案将是实施MaterialComponents
library,这将允许您在较旧的设备上使用较新的样式/小部件。寻找造成您问题的View
,然后将其替换为上述库或设置兼容样式