java - not - typeface in android

“RuntimeException: native typeface cannot be made” when loading font (6)

I am attempting to use a custom font for a TextView on Android, following the guide here and here. Using the same font, same code, same everything, I get this in adb logcat:

W/dalvikvm(  317): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime(  317): FATAL EXCEPTION: main
E/AndroidRuntime(  317): java.lang.RuntimeException: Unable to start activity  ComponentInfo{org.evilx.quacklock/org.evilx.quacklock.MainActivity}:             java.lang.RuntimeException: native typeface cannot be made
E/AndroidRuntime(  317):        at
E/AndroidRuntime(  317):        at
E/AndroidRuntime(  317):        at$2300(
E/AndroidRuntime(  317):        at$H.handleMessage(
E/AndroidRuntime(  317):        at android.os.Handler.dispatchMessage(
E/AndroidRuntime(  317):        at android.os.Looper.loop(
E/AndroidRuntime(  317):        at
E/AndroidRuntime(  317):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  317):        at java.lang.reflect.Method.invoke(
E/AndroidRuntime(  317):        at$
E/AndroidRuntime(  317):        at
E/AndroidRuntime(  317):        at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  317): Caused by: java.lang.RuntimeException: native typeface cannot be made
E/AndroidRuntime(  317):        at<init>(
E/AndroidRuntime(  317):        at
E/AndroidRuntime(  317):        at org.evilx.quacklock.MainActivity.onCreate(
E/AndroidRuntime(  317):        at
E/AndroidRuntime(  317):        at
E/AndroidRuntime(  317):        ... 11 more
W/ActivityManager(   59):   Force finishing activity org.evilx.quacklock/.MainActivity
W/ActivityManager(   59): Activity pause timeout for HistoryRecord{43e80368 org.evilx.quacklock/.MainActivity}
D/dalvikvm(  247): GC_EXPLICIT freed 711 objects / 53160 bytes in 20922ms

Hmm... okay. I'm using the font Molot.otf, which was successfully used in one of the blogs. I'm also using predator.ttf, another custom font but in TrueType format

Relevant code:

public class MainActivity extends Activity {
        /** Called when the activity is first created. */
        public void onCreate(Bundle icicle) {
            Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Molot.otf");
            TextView tv = (TextView) findViewById(;


<?xml version="1.0" encoding="utf-8"?>
        android:text="Here is some text.">

What would be causing this? It worked for the people in the blogs, so why not me? Did something significant change in the API that's preventing me from doing this?

@deng his answer worked for me":

check font's name and extension. it is case sensitive & probably all caps. eg.

Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/MOLOT.OTF")

Android does not support OpenType (OTF), only TrueType (TTF), so your Molot.otf font probably will not work. I wrote both of those blog posts you link to in your opening sentence (the one is a pirated copy of the other), and they do not use Molot.otf.

(BTW, I somewhat repaired the formatting of that post -- AndroidGuys keeps changing WordPress hosts, and so my older posts are terribly broken in terms of formatting).

EDIT: As stated in the comments, Android DOES now support OTF.

Android does support OTF files for Typefaces, if you're facing this problem, make sure that you're setting the right path for the font.put font into folder fonts inside assets folder and create the typeface as below :

Typeface typeface = Typeface.createFromAsset(getAssets(), "font/StencilStd.otf");
TextView text = (TextView) findViewById(;

FYI. My reason for the crash is some reason caused by Eclipse. All I did is just cleaning the project and ran again, then it works.

Firstly, I tried the custom font in my test project which I use to try some new functions.It worked on the very first time. But it didn't work on the project i'm working on until I did as above.

So try as many methods as you can.

Unfortunately, the typeface cannot be made error is not very specific, and it can be the result of many things going wrong. It's important to check for two things:

  • The first and most important: The file is found!
  • The font is valid in your device.

The best way is to change your font file for a known valid font file.
If it fails, then it's the first problem.
If not, it's the second, so you will have to deal with FontForge or look for another font.

You should edit your font with 'Fontlab' Software in binary mod.