尝试使用 Cardslib 库时出错:无法找到属性 android:foregroundInsidePadding

Error when trying to use the Cardslib library: unable to find attribute android:foregroundInsidePadding

尝试在我的应用程序中实现 Cardslib 库时,每次尝试 运行 应用程序时都会出现此错误:

ERROR: In ForegroundLinearLayout, unable to find attribute android:foregroundInsidePadding

但是,在查看库的 attrs.xml 文件后,我发现 ForegroundLinearLayout 并且该属性就在那里。知道是什么原因造成的吗?

此问题来自升级构建工具的要求,如前所述here

在我的例子中,我所需要的只是 build.gradle 的变化。

...
compileSdkVersion 23
buildToolsVersion "21.1.2"
...

...
compileSdkVersion 23
buildToolsVersion "22.0.1"
...

如果您正在使用 Android Studio 并且您没有安装最新的构建工具,系统将提示您使用可以自动安装它的向导。