我正在尝试运行从以下 https://github.com/material-components/material-components-android 获取的相同的 android 材料设计
但出现这些错误:
failed
:lib:packageDebugResources
tokens.xml
Can't determine type for tag '<macro name="m3_comp_bottom_app_bar_container_color">?attr/colorSurface</macro>'
tokens.xml
Can't determine type for tag '<macro name="m3_sys_color_dark_surface_tint">?attr/colorPrimary</macro>'
fab_tokens.xml
Can't determine type for tag '<macro name="m3_comp_fab_primary_container_color">?attr/colorPrimaryContainer</macro>'
tokens.xml
Can't determine type for tag '<macro name="m3_comp_switch_selected_icon_color">?attr/colorOnPrimaryContainer</macro>'
tokens.xml
Can't determine type for tag '<macro name="m3_sys_motion_path">linear</macro>'
tokens.xml
Can't determine type for tag '<macro name="m3_sys_shape_corner_full_family">rounded</macro>'
tokens.xml
Can't determine type for tag '<macro name="m3_ref_typeface_brand_regular">sans-serif</macro>'
/Users/mac/AndroidStudioProjects/material-components-android/lib/java/com/google/android/material/bottomappbar/res/values/tokens.xml: Error: Can't determine type for tag '<macro name="m3_comp_bottom_app_bar_container_color">?attr/colorSurface</macro>'
原文由 neerajt 发布,翻译遵循 CC BY-SA 4.0 许可协议
使用当前版本的android studio(从4.2更新到2021.2.1并使用推荐的gradle插件)后问题解决了
当我打开相同的缺陷时从 github 得到以下回复“您附加的错误消息说无法识别资源标签,这需要 AGP 7.2。您必须使用高于 1.7.0-alpha02 的版本,请确保您的应用程序使用所需的最低插件版本。”