android - 更新 Visual Studio 2019 后在 Xamarin 表单中找不到字体资产 fonts/.ttf
问题描述
昨天我把vs2019从v16.5.4更新到了v16.6.0。现在我在 Xamarin forms android 应用程序中遇到了Font assets not found fonts/.ttf的问题。应用程序在更新之前运行良好。更新后出现这个问题。如果我清理并重建项目,则应用程序可以工作,但在下一次运行中,此 RuntimeException 再次弹出。我需要再次清理和重建项目。
日志..
05-27 16:17:21.713 W/monodroid-assembly(22450): typemap: unable to find mapping to a managed type from Java type 'com/android/internal/policy/PhoneLayoutInflater'
05-27 16:17:21.715 W/monodroid-assembly(22450): typemap: unable to find mapping to a managed type from Java type 'android/support/v4/app/FragmentManagerImpl'
05-27 16:17:21.731 D/Mono (22450): Requesting loading reference 8 (of 20) of Xamarin.Forms.Platform.Android.dll
05-27 16:17:21.731 D/Mono (22450): Loading reference 8 of Xamarin.Forms.Platform.Android.dll asmctx DEFAULT, looking for Xamarin.Android.Support.Compat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
05-27 16:17:21.731 D/Mono (22450): Assembly Ref addref Xamarin.Forms.Platform.Android[0x7f671f7300] -> Xamarin.Android.Support.Compat[0x7f6716a000]: 5
**Java.Lang.RuntimeException:** 'Font asset not found fonts/Questrial-Regular.ttf'
应用程序.xaml
<OnPlatform x:Key="Lato-Regular" x:TypeArguments="x:String" iOS="Raleway-Regular" Android="fonts/Lato-Regular.ttf#Lato-Regular" />
<OnPlatform x:Key="Questrial-Regular" x:TypeArguments="x:String" iOS="Questrial-Regular" Android="fonts/Questrial-Regular.ttf#Questrial-Regular" />
<OnPlatform x:Key="OpenSans-Regular" x:TypeArguments="x:String" iOS="Raleway-Regular" Android="fonts/OpenSans-Regular.ttf#OpenSans-Regular" />
<OnPlatform x:Key="Roboto-Medium" x:TypeArguments="x:String" iOS="Roboto-Medium" Android="fonts/Roboto-Medium.ttf#Roboto-Medium" />
<OnPlatform x:Key="NumberFontFamily" x:TypeArguments="x:String" iOS="sans-serif" Android="sans-serif" />
解决方案
推荐阅读
- mysql - MySQL Indexes: Why does multi-column index perform worse than single column index?
- php - What if adapter class needs to be type hinted? (php)
- java - 从 JSON 而不是 DRL 加载规则/模型 - Drools
- raspberry-pi - Raspberry PI / IOTEdge 无法从 Azure 容器注册表中提取
- javascript - Node.js:如何防止同时调用异步函数
- android - 在 pin windows 模式下防止其他应用程序覆盖我的应用程序
- node.js - Error when trying to type 'node start' MEAN stack
- influxdb - InfluxDB: store data in a single measurement
- python - Improve min/max downsampling
- php - 如何调试 Laravel 站点显示 HTTP 错误 500?