I have a rather traditional question. In my app I have this line:
Typeface font = Typeface.createFromAsset(getAssets(), "fonts/fontawesome-webfont.ttf");
And it returns an exception:
RuntimeException: native typeface cannot be made
What I have:
- my
assets
folder is insrc/main/
folder of my app; In build.gradle file a wrote the following lines:
sourceSets { main { assets.srcDirs = ['assets'] } }
- my filename and extension are in lower case.
I wrote I think all the stackoverflow posts about this problem and tried the following solutions:
- I wrote
context.getAssets()
andcontext.getRessources().getAssets()
instead of simplygetAssets()
- I tried to put my font file to fonts dauther older and directly to assets folder
- I tried to check TTF extension instead of ttf
- I tried to remove - and _ simbols from the file name
Nothing has helped me. May be you know another solution?
Thank you.