Domanda

I have searched a bit but all the answers on the exception is related to people loading the wrong font.

However, I am trying to load a TrueType font. It works for the majority of the devices I have tested on. However, when trying to load on the Tab 10.1 running Android 3.1 or EEEPad running 3.2 I get the following exception:

Caused by: java.lang.RuntimeException: native typeface cannot be made

The complete stack trace:

java.lang.RuntimeException: Unable to start activity ComponentInfo{se.healthyheroes.android.app/se.healthyheroes.android.app.LoginActivity}: java.lang.RuntimeException: native typeface cannot be made
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1815)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
    at android.app.ActivityThread.access$500(ActivityThread.java:122)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:132)
    at android.app.ActivityThread.main(ActivityThread.java:4123)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: native typeface cannot be made
    at android.graphics.Typeface.<init>(Typeface.java:147)
    at android.graphics.Typeface.createFromAsset(Typeface.java:121)
    at se.healthyheroes.android.app.LoginActivity.initViews(LoginActivity.java:154)
    at se.healthyheroes.android.app.LoginActivity.onCreate(LoginActivity.java:94)
    at android.app.Activity.performCreate(Activity.java:4397)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
    ... 11 more
java.lang.RuntimeException: native typeface cannot be made
    at android.graphics.Typeface.<init>(Typeface.java:147)
    at android.graphics.Typeface.createFromAsset(Typeface.java:121)
    at se.healthyheroes.android.app.LoginActivity.initViews(LoginActivity.java:154)
    at se.healthyheroes.android.app.LoginActivity.onCreate(LoginActivity.java:94)
    at android.app.Activity.performCreate(Activity.java:4397)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
    at android.app.ActivityThread.access$500(ActivityThread.java:122)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:132)
    at android.app.ActivityThread.main(ActivityThread.java:4123)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
    at dalvik.system.NativeStart.main(Native Method)

You might wonder about line 154 in LoginActivity. The line is this one:

Typeface tf =(Typeface.createFromAsset(getAssets(), "fonts/style_5784.ttf"));

The font is located under "assets/fonts/style_5784.ttf" in my project in Eclipse. The really weird thing is that it works on all the other devices except honeycomb.

Does anyone have an idea what could cause the exception? Could the font be broken or perhaps there is something as simple as the name of the file? The only thing I managed to understand by searching around for it is that it could be the font that is broken somehow.

È stato utile?

Soluzione

Upon looking further into this error it doesn't look like the error is being causing by the font name. The error is occurring inside of native code which is most likely changed in Honeycomb and cannot be debugged through a stack trace.

Until the source has been released we will not be able to look further into the error.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top