.NET MAUI app throws Java.Lang.RuntimeException with Font asset not found /data/user/0/app.xyz/cache/telerikfont.ttf

1 Answer 444 Views
General Discussions
Patrick
Top achievements
Rank 1
Patrick asked on 06 Dec 2024, 09:57 AM

We recently discovered that our .NET MAUI APP (8.0.92) throws a Java.Lang.RuntimeException with Font asset not found /data/user/0/app.xyz/cache/telerikfont.ttf.

Here's the full exception detail:

Java.Lang.RuntimeException:
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop, Version=7.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065)
   at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (Java.Interop, Version=7.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065)
   at Android.Graphics.Typeface.CreateFromAsset (Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065)
   at Microsoft.Maui.FontManager.LoadTypefaceFromAsset (Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)

 

We do have a "Font" folder in our Application, but in our understanding this shouldn't be a problem anymore.

We register those fonts, which are in the Fonts folder:

.ConfigureFonts(fonts =>
{
	fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
	fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
	fonts.AddFont("FontAwesomePro-Light-300.otf", "FontAwesomeLight");
	fonts.AddFont("FontAwesomePro-Regular-400.otf", "FontAwesomeRegular");
	fonts.AddFont("FontAwesomePro-Solid-900.otf", "FontAwesomeSolid");
});


In addition to that, we have a custom CustomFontsProvider for the fonts we use in the RadPdfProcessing lib for .NET MAUI. Those fonts are however in the RAW.


public class CustomFontsProvider : Telerik.Windows.Documents.Extensibility.FontsProviderBase

{ public override byte[] GetFontData(Telerik.Windows.Documents.Core.Fonts.FontProperties fontProperties) { string fontFileName = fontProperties.FontFamilyName + ".ttf"; if (fontProperties.FontFamilyName == "Verdana") { if (fontProperties.FontStyle == FontStyles.Normal && fontProperties.FontWeight == FontWeights.Normal) { fontFileName = $"Verdana.ttf"; } elseif (fontProperties.FontWeight == FontWeights.Bold) { fontFileName = $"Verdana-Bold.ttf"; } } var fileStream = FileSystem.Current.OpenAppPackageFileAsync(fontFileName).GetAwaiter().GetResult(); var memoryStream = new MemoryStream(); fileStream.CopyTo(memoryStream); return memoryStream.ToArray(); } }

 

How can we resolve this issue? Any support is appreciated.

 

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 10 Dec 2024, 11:37 AM | edited on 10 Dec 2024, 11:38 AM

Hi Patrick,

I tested the scenario in a sample app and cannot reproduce the exception. Could you please send a sample in which the issue happens? 

Check whether you use the Telerik MAUI 8.0.0 version and let me know whether the issue happens in release or debug mode? Also delete bin and obj folders then build the app and test.

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Andrey
Top achievements
Rank 1
Iron
commented on 31 Oct 2025, 07:56 PM | edited

Hi Didi, happening with the following config in RELEASE:

<PackageReference Include="Telerik.UI.for.Maui" Version="10.1.0" />

 <RuntimeIdentifier>android-arm</RuntimeIdentifier>
 <PublishTrimmed>true</PublishTrimmed>
 <TrimMode>full</TrimMode>
 <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
 <EnableLLVM>true</EnableLLVM>
 <RunAOTCompilation>true</RunAOTCompilation>
Didi
Telerik team
commented on 03 Nov 2025, 08:40 AM

Hi Andrey,

We have our Controls Samples app in the stores and such issue does not observe. 

As a next steps: open a support ticket and attach a sample app there, so I can research the case further.

Jones
Top achievements
Rank 1
commented on 10 Dec 2025, 10:35 PM

Hi Didi,

I'm also getting the same error when debugging using an Android simulator in a MAUI net9 app, with different versions of Telerik, including the latest one.

Would you please provide a link from which to download it?

Microsoft.Maui.FontManager: Warning: Unable to load font '/data/user/0/com.officecore.officetrackplus/cache/telerikfont.ttf' from assets.

Java.Lang.RuntimeException: Font asset not found /data/user/0/com.officecore.officetrackplus/cache/telerikfont.ttf
   at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference type, JniMethodInfo method, JniArgumentValue* args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/net8.0/JniEnvironment.g.cs:line 21453
   at Java.Interop.JniPeerMembers.JniStaticMethods.InvokeObjectMethod(String encodedMember, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniStaticMethods.cs:line 165
   at Android.Graphics.Typeface.CreateFromAsset(AssetManager mgr, String path) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net9.0/android-35/mcw/Android.Graphics.Typeface.cs:line 637
   at Microsoft.Maui.FontManager.LoadTypefaceFromAsset(String fontfamily, Boolean warning) in /_/src/Core/src/Fonts/FontManager.Android.cs:line 133
  --- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: Font asset not found /data/user/0/com.officecore.officetrackplus/cache/telerikfont.ttf
Didi
Telerik team
commented on 11 Dec 2025, 02:08 PM

Hi Jones,

Could you please open a support ticket and attach a sample app in which the issue happens, so I can further research the behavior. As on my side such exception does not occur. The font mentioned in the exception is our internal font used in the controls, so this font is not shared in the sample apps we have. I can send it via a support ticket, however I want to research why such error occurs on android.

Lets continue the communication in a support ticket. 

Tags
General Discussions
Asked by
Patrick
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or