Question

NokiaX reports this exception on fonts used.

I have a library project under which I have assets/fonts/Roboto-*.ttf files. I have gone through the other questions on this topic, all of them hint at spelling check, or folder check (should be under assets/fonts). None of them seem to be the issue. This code works well with Android.

What am I missing here ?

05-04 10:19:49.430: E/Crittercism(17208): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.taxeeta.nokiax/com.taxeeta.SplashScreen}: java.lang.RuntimeException: native typeface cannot be made
05-04 10:19:49.430: E/Crittercism(17208):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2067)
05-04 10:19:49.430: E/Crittercism(17208):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
05-04 10:19:49.430: E/Crittercism(17208):   at android.app.ActivityThread.access$600(ActivityThread.java:133)
05-04 10:19:49.430: E/Crittercism(17208):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
05-04 10:19:49.430: E/Crittercism(17208):   at android.os.Handler.dispatchMessage(Handler.java:99)
05-04 10:19:49.430: E/Crittercism(17208):   at android.os.Looper.loop(Looper.java:137)
05-04 10:19:49.430: E/Crittercism(17208):   at android.app.ActivityThread.main(ActivityThread.java:4807)
05-04 10:19:49.430: E/Crittercism(17208):   at java.lang.reflect.Method.invokeNative(Native Method)
05-04 10:19:49.430: E/Crittercism(17208):   at java.lang.reflect.Method.invoke(Method.java:511)
05-04 10:19:49.430: E/Crittercism(17208):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
05-04 10:19:49.430: E/Crittercism(17208):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559)
05-04 10:19:49.430: E/Crittercism(17208):   at dalvik.system.NativeStart.main(Native Method)
05-04 10:19:49.430: E/Crittercism(17208): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-04 10:19:49.430: E/Crittercism(17208):   at android.graphics.Typeface.<init>(Typeface.java:175)
05-04 10:19:49.430: E/Crittercism(17208):   at android.graphics.Typeface.createFromAsset(Typeface.java:149)
05-04 10:19:49.430: E/Crittercism(17208):   at com.taxeeta.support.FontUtils.setRobotoFont(FontUtils.java:14)
05-04 10:19:49.430: E/Crittercism(17208):   at com.taxeeta.SplashScreen.onCreate(SplashScreen.java:165)
05-04 10:19:49.430: E/Crittercism(17208):   at android.app.Activity.performCreate(Activity.java:5180)
05-04 10:19:49.430: E/Crittercism(17208):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
05-04 10:19:49.430: E/Crittercism(17208):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
05-04 10:19:49.430: E/Crittercism(17208):   ... 11 more
Was it helpful?

Solution

Just found this in the android docs. Cool. I moved the fonts folder out of the library project and into the application project and all worked fine.

Library projects cannot include raw assets

The tools do not support the use of raw asset files (saved in the assets/ directory) in a library project. Any asset resources used by an application must be stored in the assets/ directory of the application project itself. However, resource files saved in the res/ directory are supported.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top