android – nokiax报告java.lang.RuntimeException:无法生成本机字体

前端之家收集整理的这篇文章主要介绍了android – nokiax报告java.lang.RuntimeException:无法生成本机字体前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
NokiaX在使用的字体上报告此例外情况.

我有一个库项目,我有资产/字体/ Roboto – * .ttf文件.我已经完成了关于这个主题的其他问题,所有这些都提示拼写检查或文件夹检查(应该在资产/字体下).似乎没有一个问题.此代码适用于Android.

我在这里错过了什么?

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

解决方法

刚刚在android文档中找到了这个.凉.我将fonts文件夹移出了库项目并进入了应用程序项目,一切正常.

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.

猜你在找的Android相关文章