Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] Android Embedded Ttf resource throwing exception #13056

Closed
EmilAlipiev opened this issue Dec 5, 2020 · 3 comments
Closed

[Bug] Android Embedded Ttf resource throwing exception #13056

EmilAlipiev opened this issue Dec 5, 2020 · 3 comments
Labels
s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. s/unverified New report that has yet to be verified t/bug 🐛

Comments

@EmilAlipiev
Copy link
Contributor

Description

I am using Roboto-Regular ttf as embedded in my xamarin.forms app. Everything works fine for me and i cannot reproduce any error but for some users i am seeing this crash in my Appcenter logs. I have edded is embedded resource and defined in app.xaml.cs as [assembly: ExportFont("Roboto-Regular.ttf", Alias = "FontRegular")]

What could be the problem here? any idea?

Xamarin Exception Stack:
Java.Lang.RuntimeException: Font asset not found /data/user/0/com.mycompany.myapp/cache/Roboto-Regular.ttf
  at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <98256a5ebcdb4f019a0bacb554da830a>:0
  at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) <0x73558157a8 + 0x00063> in <98256a5ebcdb4f019a0bacb554da830a>:0
  at Android.Graphics.Typeface.CreateFromFile (System.String path) [0x00029] in <0861bd84e5884e54a92d3bd4b8a806f3>:0
  at Xamarin.Forms.Platform.Android.FontExtensions.TryGetFromAssets (System.String fontName) [0x00016] in <6dceb1a49ccb49119610c59f51320500>:0
  at Xamarin.Forms.Platform.Android.FontExtensions.ToTypeFace (System.String fontfamily, Xamarin.Forms.FontAttributes attr) [0x0000c] in <6dceb1a49ccb49119610c59f51320500>:0
  at Xamarin.Forms.Platform.Android.FontExtensions.CreateTypeface (System.Tuple`2[T1,T2] key) [0x0004b] in <6dceb1a49ccb49119610c59f51320500>:0
  at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) <0x7357330724 + 0x000a7> in <e80227fc9dc44eee8ab9c169425ebeb6>:0
  at Xamarin.Forms.Platform.Android.FontExtensions.ToTypeface (System.String fontFamily, Xamarin.Forms.FontAttributes fontAttributes) [0x00018] in <6dceb1a49ccb49119610c59f51320500>:0
  at Xamarin.Forms.Platform.Android.FontExtensions.ToTypeface (Xamarin.Forms.Font self) <0x7354b60c10 + 0x0006b> in <6dceb1a49ccb49119610c59f51320500>:0
  at Xamarin.Forms.Platform.Android.FormattedStringExtensions+FontSpan.Apply (Android.Graphics.Paint paint) <0x7354b61424 + 0x00047> in <6dceb1a49ccb49119610c59f51320500>:0
  at Xamarin.Forms.Platform.Android.FormattedStringExtensions+FontSpan.UpdateDrawState (Android.Text.TextPaint tp) <0x7354b6139c + 0x0002f> in <6dceb1a49ccb49119610c59f51320500>:0
  at Android.Text.Style.CharacterStyle.n_UpdateDrawState_Landroid_text_TextPaint_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_tp) [0x0000f] in <0861bd84e5884e54a92d3bd4b8a806f3>:0
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.123(intptr,intptr,intptr)
  at java.lang.RuntimeException: Font asset not found /data/user/0/com.mycompany.myapp/cache/Roboto-Regular.ttf
  at android.graphics.Typeface.createFromFile(Typeface.java:1039)
  at android.graphics.Typeface.createFromFile(Typeface.java:1053)
  at crc643f46942d9dd1fff9.FormattedStringExtensions_FontSpan.n_updateDrawState(Native Method)
  at crc643f46942d9dd1fff9.FormattedStringExtensions_FontSpan.updateDrawState(Unknown Source:0)
  at android.text.TextLine.handleRun(TextLine.java:1153)
  at android.text.TextLine.measureRun(TextLine.java:510)
  at android.text.TextLine.measure(TextLine.java:378)
  at android.text.TextLine.metrics(TextLine.java:306)
  at android.text.BoringLayout.isBoring(BoringLayout.java:366)
  at android.widget.TextView.onMeasure(TextView.java:9559)
  at android.view.View.measure(View.java:25169)
  at mono.java.lang.RunnableImplementor.n_run(Native Method)
  at mono.java.lang.RunnableImplementor.run(Unknown Source:0)
  at android.os.Handler.handleCallback(Handler.java:883)
  at android.os.Handler.dispatchMessage(Handler.java:100)
  at android.os.Looper.loop(Looper.java:214)
  at android.app.ActivityThread.main(ActivityThread.java:7615)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

Basic Information

  • Version with issue:
  • Last known good version:
  • Platform Target Frameworks:
    • Android: 10
  • NuGet Packages: XF 4.8.0.1687
  • Affected Devices:
    Android Build: QKQ1.200308.002
    Manufacturer: LGE
    Model: LM-Q720
@EmilAlipiev EmilAlipiev added s/unverified New report that has yet to be verified t/bug 🐛 labels Dec 5, 2020
@StephaneDelcroix
Copy link
Member

at the very minimum, Xamarin.Forms.Platform.Android.FontExtensions.TryGetFromAssets shouldn't throw

@StephaneDelcroix
Copy link
Member

anything special with the language/culture of those affected users ?

@rachelkang rachelkang added s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels Dec 21, 2020
@Redth
Copy link
Member

Redth commented Jan 21, 2021

Since we haven't heard from you in more than 30 days, we hope this issue is no longer affecting you. If it is, please reopen this issue and provide the requested information so that we can look into it further. Thank you!

@Redth Redth closed this as completed Jan 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

4 participants