gpt4 book ai didi

android - nokiax 报告 java.lang.RuntimeException : native typeface cannot be made

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:54:53 25 4
gpt4 key购买 nike

NokiaX 在使用的​​字体上报告此异常。

我有一个库项目,在该项目下有 assets/fonts/Roboto-*.ttf 文件。我已经完成了关于这个主题的其他问题,所有这些问题都提示拼写检查或文件夹检查(应该在 assets/fonts 下)。他们似乎都不是问题。此代码适用于 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 文档中找到了这个。凉爽的。我将字体文件夹从库项目移到应用程序项目中,一切正常。

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 - nokiax 报告 java.lang.RuntimeException : native typeface cannot be made,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23451926/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com