I am trying to run android material design same taken from below https://github.com/material-components/material-components-android
but getting these errors :
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>'
6
Answers
Problem is solve after using current version of android studio ( updated from 4.2 to 2021.2.1 and used recommended gradle plugin )
Got the below reply from github when i open defect for same "The error message you attached says not recognizing resource tag, which requires AGP 7.2. You must use a version later than 1.7.0-alpha02, please make sure your app build with the minimum required plugin versions."
I got the same error when upgrade to this version
But working fine in
updating the Android Gradle plugin to 7.3.3 (gradle-7.3.3-bin.zip)
things will be ok.
Replace :
with:
in
build.gradle(:app)
file underdependencies { }
Try downgrading material design library in build.gradle(app).
I have changed
to
And this resolved my issue.
This issue should be relevant to people who dig deeper and do not directly work with these dependencies, as it works fine for building and running apps in Android Studio.
It seems that material
1.7.0
is using illegal tag<macro>
, you can see it in multiple files when looking through their release changes, specifically the**/tokens.xml
files. I could not find any information about this tag in AGP documentation and the only references to it I found from this git repo was this part of the codeSo I’m not really sure how did they work around it.
In the future it is possible that AGP will support this tag externally and include it in their documentation, but for now you’ll have to use workarounds