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

thelearner picture thelearner · Oct 14, 2017 · Viewed 8k times · Source

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

Answer

AskNilesh picture AskNilesh · Oct 14, 2017

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