Search code examples
androidandroid-design-libraryandroid-debugandroid-fonts

Can't use fonts in my project: - "Error:Error: The file name must end with .xml"


I'm trying to add a font to my Android project, so I can use it via XML. Unfortunately, I'm getting this error message:

Error:Error: The file name must end with .xml

I followed every step of the official Android tutorial and somehow this error occurs and I can't fix it.

Here is this my error


Solution

  • You can't add font.ttf file in Drawable folder

    you need to create Assets folder in android you can create Assets folder like below image in Android studio

    enter image description here

    than create a font folder in Assets folder and put your custom font.ttf file in this folder like below image

    enter image description here