Font asset not found helvetica.ttf on lollipop –

Development issue/problem:

For some reason I get this mistake on lollipops, and since lollipops are so new, I can’t understand why, and I have no idea how to do it. Thank you in advance for the logcat error:

java.lang.RuntimeException : Can ComponentInfo{com.bent.MissionaryTracker.MainActivity}:java.lang.RuntimeException : Active with font not found helvetica.ttf
to$800 (
to$H.handleMessage (
to android.os.Handler.dispatchMessage (
to android.os.Looper.loop(
to java.lang.reflect.Method.invoke(Native Method)
to java.lang.reflect.Method.invoke(
Reason: java.lang.RuntimeException : Font asset not found helvetica.ttf
at (
at com.bent.MissionaryTracker.MainActivity.onCreate (
…. Another 10


title = (TextView) findViewById( ;

Font = Typeface.createFromAsset(getAssets(), helvetica.ttf) ;
title.setTypeface(font) ;

I have helvetica.ttf in the asset folder of the project files.

This application works on all devices up to and including version 5.0. For some reason, version 5.0 does not recognize the file in the My Assets folder.

I tried to place a screenshot in my assets folder, but I don’t have enough credit to post photos.

How can I solve this problem?

Solution 1:

If you work with Android Studio, make sure your assets are in the root folder and not in the

Solution 2:

It is now preferable to use this approach for custom fonts.

Saving fonts in red/font

To the :

Type the font = ResourcesCompat.getFont(context, R.font.myfont) ;

Solution 3:

I, too, had this problem before I realized that I hadn’t preceded the .otf file with fonts/.

Font type = Typeface.createFromAsset(getAssets(),fonts/TTTMastersDEMOBlack.ttf) ;

Solution 4:

It worked for me. In my case it didn’t work because I created an assets map in res instead of in main.

See also  Clubhouse: a New Trend and the Essence of an Application

Give here a description of the image

Solution No 5:

If the folder change does not work, the Android team may have already fixed the problem, but didn’t have time to do it during version 5.0. It’s all explained here:

The solution (at least for me) is to correct font files with TTX, as mentioned in a related problem.

Running TTX can be a bit cumbersome if you have no experience with Pythons, so I finally downloaded Adobe’s AFDKO, including TTX. You need to run ttx yourfontfile.ttf which will convert your file to .ttx and then run ttx yourfontfile.ttx again to get a new .ttf that works with version 5.0.

Solution No 6:

Clear project, it worked for me on Android 6.0.

Solution No 7:

Put the Assets folder in the root folder.
After that:

Typeface=Typeface.createFromAsset(getAssets(),OpenSans-Light.ttf) ;
textView.setTypeface(font) ;

Solution No 8:

I’ve encountered this problem before. I removed x.ttf, then I undid the removal and tried to boot without locking. So I just erased it, downloaded the font again and added it to the font file, and it worked fine.

Solution No 9:

Okay, guys,

I had the same problem. First of all, I made my font loading logic shockproof:

* Init method. This method must be called for any other call in this class.
public static void init() {
fontPlain = createFont( helveteticab.ttf , Typeface.NORMAL ) ;
fontBold = createFont( helveteticab.ttf , Typeface.BOLD ) ;

* Load the font from the Asset Font folder.
public static Typeface createFont (String font, int style) {
try {
AssetManager assets = Kit.getAppContext().getAssets();
typeface = Typeface.createFromAsset( assets, fonts + File.separator + font );
catch (RuntimeException e) {
// createFromAsset() launches a RuntimeException if it fails.
Log.e ( Constants.TAG, Cannot create font: + font, e );
font = Typeface.defaultFromStyle( style );
inverted font;

See also  8 Best Laptop for Researchers

I also downloaded another font from this project in git:

I noticed that my old font was 56 KB and the new one 84 KB. I think I had an older version of the police.

Make sure you have the correct license before using this policy.

Good luck!

Related Tags:

font asset not found xamarin,font asset not found fonts calibri ttf,xamarin forms custom font,xamarin forms font awesome,xamarin css font size,java lang runtimeexception font asset not found fonts null,r font not found android,java lang runtimeexception font asset not found font roboto_medium ttf,android studio resource font not found,get typeface from font folder android,how to get fonts from assets in android