Microsoft.Maui.FontManager: Warning: Unable to load font 'sans-serif-medium' from assets.
See original GitHub issueDescription
There are no changes about fonts of project, when start debuging a simple program just has added communitytoolkit.mvvm and use class:ObservableObject attr: [ObservableProperty] attr:[RelayCommand] then font warning is appeared how to slove it?
> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.companyname.m3/crc64f3d528bca3d24857.MainActivity"
> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.companyname.m3/crc64f3d528bca3d24857.MainActivity }
Resolved pending breakpoint for 'Android.Runtime.JNIEnv.RegisterJniNatives(System.IntPtr, System.Int32, System.IntPtr, System.IntPtr, System.Int32)' to /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:127 [0x00000].
Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:423 [0x00000].
Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:418 [0x00000].
[.companyname.m] Late-enabling -Xcheck:jni
[.companyname.m] Unquickening 12 vdex files!
[.companyname.m] Unexpected CPU variant for X86 using defaults: x86_64
[.companyname.m] The ClassLoaderContext is a special shared library.
[NetworkSecurityConfig] No Network Security Config specified, using platform default
[NetworkSecurityConfig] No Network Security Config specified, using platform default
[debug-app-helper] Checking if libmonodroid was unpacked to /data/app/~~VJPZXjgXgUpvzaIZui6sJA==/com.companyname.m3-hjElyQLeTMNL9_qRI5s9Iw==/lib/x86_64/libmonodroid.so
[debug-app-helper] Native libs extracted to /data/app/~~VJPZXjgXgUpvzaIZui6sJA==/com.companyname.m3-hjElyQLeTMNL9_qRI5s9Iw==/lib/x86_64, assuming application/android:extractNativeLibs == true
[debug-app-helper] Setting up for DSO lookup in app data directories
[debug-app-helper] Added filesystem DSO lookup location: /data/app/~~VJPZXjgXgUpvzaIZui6sJA==/com.companyname.m3-hjElyQLeTMNL9_qRI5s9Iw==/lib/x86_64
[debug-app-helper] Using runtime path: /data/app/~~VJPZXjgXgUpvzaIZui6sJA==/com.companyname.m3-hjElyQLeTMNL9_qRI5s9Iw==/lib/x86_64
[debug-app-helper] checking directory: `/data/user/0/com.companyname.m3/files/.__override__/lib`
[debug-app-helper] directory does not exist: `/data/user/0/com.companyname.m3/files/.__override__/lib`
[debug-app-helper] Checking whether Mono runtime exists at: /data/user/0/com.companyname.m3/files/.__override__/libmonosgen-2.0.so
[debug-app-helper] Checking whether Mono runtime exists at: /data/app/~~VJPZXjgXgUpvzaIZui6sJA==/com.companyname.m3-hjElyQLeTMNL9_qRI5s9Iw==/lib/x86_64/libmonosgen-2.0.so
[debug-app-helper] Mono runtime found at: /data/app/~~VJPZXjgXgUpvzaIZui6sJA==/com.companyname.m3-hjElyQLeTMNL9_qRI5s9Iw==/lib/x86_64/libmonosgen-2.0.so
[.companyname.m] Attempt to remove non-JNI local reference, dumping thread
[DOTNET] JNI_OnLoad: JNI_OnLoad in pal_jni.c
[monodroid] Creating public update directory: `/data/user/0/com.companyname.m3/files/.__override__`
[.companyname.m] Attempt to remove non-JNI local reference, dumping thread
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:50923,embedding=1
[monodroid-assembly] open_from_bundles: failed to load assembly m3.dll
[monodroid-gc] GREF GC Threshold: 46080
[monodroid-assembly] open_from_bundles: failed to load assembly Mono.Android.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Java.Interop.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.InteropServices.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Threading.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Threading.Thread.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.StackTrace.dll
[.companyname.m] Attempt to remove non-JNI local reference, dumping thread
[monodroid-assembly] open_from_bundles: failed to load assembly netstandard.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Linq.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.Concurrent.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Json.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encodings.Web.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.ComponentModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.ObjectModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Graphics.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Essentials.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.Abstractions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.ComponentModel.TypeConverter.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.Uri.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Loader.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Memory.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Emit.Lightweight.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Emit.ILGeneration.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Primitives.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Core.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.Abstractions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Console.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.Xaml.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.Abstractions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.Debug.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.AppCompat.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.Google.Android.Material.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.SwipeRefreshLayout.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Fragment.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Activity.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.ViewModel.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.Common.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.SavedState.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.DrawerLayout.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CustomView.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Navigation.Runtime.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Net.Primitives.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Options.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.Tracing.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Xml.ReaderWriter.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.Xml.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encoding.Extensions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Numerics.Vectors.dll
[.companyname.m] Explicit concurrent copying GC freed 28343(1792KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 1924KB/2565KB, paused 585us total 3.900ms
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.RegularExpressions.dll
Thread started: #2
Thread started: #3
Thread started: #4
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Json.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Private.DataContractSerialization.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Xml.dll
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Primitives.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.RecyclerView.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CardView.dll
[libEGL] loaded /vendor/lib64/egl/libEGL_emulation.so
[libEGL] loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
[libEGL] loaded /vendor/lib64/egl/libGLESv2_emulation.so
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Loader.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.Compatibility.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Window.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CoordinatorLayout.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.LiveData.Core.dll
[.companyname.m] Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
[.companyname.m] Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.ViewPager2.dll
[TabLayout] MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.Runtime.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.ViewPager.dll
[monodroid-assembly] open_from_bundles: failed to load assembly CommunityToolkit.Mvvm.dll
[.companyname.m] Explicit concurrent copying GC freed 511(50KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 2975KB/3967KB, paused 334us total 4.521ms
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.AppCompat.AppCompatResources.dll
Thread started: .NET Timer #5
[HostConnection] HostConnection::get() New Host Connection established 0x75558c984190, tid 12537
[HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0
[OpenGLRenderer] Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
[EGL_emulation] eglCreateContext: 0x75557c9bb450: maj 3 min 0 rcv 3
[EGL_emulation] eglMakeCurrent: 0x75557c9bb450: ver 3 0 (tinfo 0x75551d32a860) (first time)
[Gralloc4] mapper 4.x is not supported
[HostConnection] createUnique: call
[HostConnection] HostConnection::get() New Host Connection established 0x75558c986410, tid 12537
[goldfish-address-space] allocate: Ask for block of size 0x100
[goldfish-address-space] allocate: ioctl allocate returned offset 0x3f3ffe000 size 0x2000
[HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Emoji2.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Primitives.dll
[0:] Microsoft.Maui.FontManager: Warning: Unable to load font 'sans-serif-medium' from assets.
Java.Lang.RuntimeException: Font asset not found sans-serif-medium
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/net7.0/JniEnvironment.g.cs:line 12890
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 151
at Android.Graphics.Typeface.CreateFromAsset(AssetManager mgr, String path) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Graphics.Typeface.cs:line 613
at Microsoft.Maui.FontManager.LoadTypefaceFromAsset(String fontfamily, Boolean warning) in D:\a\_work\1\s\src\Core\src\Fonts\FontManager.Android.cs:line 122
--- End of managed Java.Lang.RuntimeException stack trace ---
Steps to Reproduce
above all
Link to public reproduction project repository
above all
Version with bug
7.0 (current)
Last version that worked well
7.0 (current)
Affected platforms
Android
Affected platform versions
Pixel 5 - API 30 Android 11.0
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created 7 months ago
- Reactions:8
- Comments:19 (4 by maintainers)
Top Results From Across the Web
font asset not found sans-serif-medium on AppShell
I am using Roboto Fonts not sans-serif-medium in shell app but I also facing this issue. It's all go well if you create...
Read more >In Maui code I am getting a missing font message but I do ...
In Maui code I am getting a missing font message but I do not have code that mentions that font - Microsoft Q&A....
Read more >Java.Lang.RuntimeException: 'Font asset not found sans- ...
Hi, judging by the stack trace you or some component you are referencing is trying to use a font which does not exist...
Read more >adding custom font in .net maui does nothing on android
public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .ConfigureFonts(fonts => { fonts.
Read more >Fonts in .NET MAUI
This article explains how to specify font information on controls that display text in .NET MAUI apps.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was encountering this error, which had the added issue that I was then unable to hit breakpoints that I placed in my code for debugging in Visual Studio. The app would continue to run, but it was no longer possible to check on the state of the application to debug after the error was thrown!
Workaround:
Download Open Sans Medium 500 Font from Google Fonts (Google Fonts - Open Sans)
Unzip the downloaded
.zip(For me:Open_Sans.zip), navigate to the unzipped folder, and copystatic/OpenSans-Medium.ttfPaste the
ttffile in your project underResources/Fonts/In your
MauiProgram.csfile, add the font:For me, on the Android Emulator, the error was no longer thrown after adding this font with the
sans-serif-mediumalias.With the error no longer being thrown, I could hit my breakpoints again without issue!
I don’t know if it’s related, but I’m noticing right now that when built in
Debug, fonts are working as expected, but when building inRelease, they are not. I’m using the latest preview version.