05-01 12:31:26.249 16555-16555/? E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.code2care.someapp/com.code2care.someapp.MainActivity}:
java.lang.RuntimeException: native typeface cannot be made
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: native typeface cannot be made
at android.graphics.Typeface.(Typeface.java:147)
at android.graphics.Typeface.createFromAsset(Typeface.java:121)
at com.code2care.someapp.MainActivity.onCreate(MainActivity.java:149)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
Solution:
The problem was that I had created the assets/fonts folder manually and placed the .ttf font file in it,
Steps resolve the issue
- Delete the assets folder if you had created it manually.
- Now move to package view.
- Right Click on app and select New -> Folder -> Assets Folder
- Now move back to Projects view and you must now see the assets folder under yourPackageName -> app -> src -> main -> assets
- Just add the fonts folder and the ttf file inside it
- Now things should work fine.
Also make sure that the way you create the Typeface object in the Java file is also correct,
This is not an AI-generated article but is demonstrated and validated by a human.
Please support independent contributors like Code2care by donating a coffee.
Buy me a coffee!

Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!