johnkil / Print

A lightweight Android library for use iconic fonts.
http://johnkil.github.io/Print
Apache License 2.0
208 stars 40 forks source link

RuntimeException: Font asset not found fonts/iconic-font.ttf #19

Closed BenoitDuffez closed 7 years ago

BenoitDuffez commented 7 years ago

I'm the developer of this project: https://github.com/BenoitDuffez/AndroidCupsPrint

I received a crash report from your code:

Fatal Exception: java.lang.RuntimeException: Unable to create application com.android.tools.fd.runtime.BootstrapApplication: java.lang.RuntimeException: Font asset not found fonts/iconic-font.ttf
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
       at android.app.ActivityThread.-wrap1(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by java.lang.RuntimeException: Font asset not found fonts/iconic-font.ttf
       at android.graphics.Typeface.createFromAsset(Typeface.java:190)
       at com.github.johnkil.print.TypefaceManager.load(TypefaceManager.java:48)
       at com.github.johnkil.print.PrintConfig.initDefault(PrintConfig.java:35)
       at io.github.benoitduffez.cupsprint.CupsPrintApp.onCreate(CupsPrintApp.java:45)
       at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:370)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
       at android.app.ActivityThread.-wrap1(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

I thought you might be interested in knowing that.

johnkil commented 7 years ago

Font asset not found fonts/iconic-font.ttf. You are sure that you have iconic-font.ttf font in assets folder?

BenoitDuffez commented 7 years ago

I don't know unfortunately. I did not get that error. I'm the dev of another app, and one user of both my app and yours got this crash (generated by your app but caught by mine).

BenoitDuffez commented 7 years ago

Sorry I didn't see your project was a lib. So I guess that a developer X used your lib to create an app Y, and a user Z of Y wanted to print something (landing on my app) and it crashed because X didn't include the font.

So I guess you can close this issue and/or add a workaround in TypefaceManager.java:48.

johnkil commented 7 years ago

Yes you are right, someone has not added this font 😉