material-dialog lib, error: No resource found that matches the given name 'android:Theme.Material.Light.Dialog.Alert'

material-dialog lib, error: No resource found that matches the given name 'android:Theme.Material.Light.Dialog.Alert'

我正在尝试导入 this material-dialog library。 收到此错误:错误:检索项目的父项时出错:找不到与给定名称 'android:Theme.Material.Light.Dialog.Alert'.

匹配的资源

在文件中获取它:values-v21/styles。xml。

我正在使用 Eclipse,并且我在 libs 文件夹中导入了 android-support-v4.jar。这里可能是什么问题?

在您的项目属性中,确保您已选择 API 级别 21 作为您的平台。此外,在您的清单文件中,将 targetSdkVersion 设置为 21。然后清理并重建您的项目,它应该可以工作。

每当您使用新的 Material Design 功能或最新版本的支持库时,都需要针对 API 级别 21 编译项目。

作为其他人 运行 对此问题的参考,请确保您已在父主题名称前加上 android:,因此完整的父标签将如下所示:

parent="android:Theme.Material.Light.Dialog.Alert">

我遇到了同样的错误,因为我复制了一些代码,但出于某种原因没有包含该前缀。