Why are my Xamarin UWP Images not showing up on de

2019-03-04 15:12发布

I am developing a Xamarin UWP app using ffimageloading. The images show up just fine on the Windows Phone emulator that I am running through Visual Studio, but when I deploy it to a device through the device portal all of the images are missing.

 <ffimageloading:CachedImage Grid.Column="0" Grid.Row="1" 
    Source="{helpers:ImageResource MyProject.Assets.Images.music-doublenote.png}" />

3条回答
Viruses.
2楼-- · 2019-03-04 16:01

The issue was the build configuration. By turning off "Compile with .NET Native tool chain" on the Build tab of Properties for the Release configuration of the main UWP app and deploying the app with WinAppDeployCmd.exe

查看更多
做自己的国王
3楼-- · 2019-03-04 16:08

To get "Compile with .NET Native tool chain" working you have to use UWP-specific overload of the Forms.Init call which allows to correctly include FFImageLoading assemblies for Xamarin.Forms usage:

// you'll need to add `using System.Reflection;`
List<Assembly> assembliesToInclude = new List<Assembly>();

//Now, add in all the assemblies your app uses
assembliesToInclude.Add(typeof (FFImageLoadingAssembliesHere).GetTypeInfo().Assembly);

//Also do this for all your other 3rd party libraries

Xamarin.Forms.Forms.Init(e, assembliesToInclude);
// replaces Xamarin.Forms.Forms.Init(e);
查看更多
看我几分像从前
4楼-- · 2019-03-04 16:19

I had the same problem whenever I kept the image file inside any folder (for. eg assests). But later i started keeping the images file in the main project folder; I didn't keep them inside any folders and they started to show up in the application.

查看更多
登录 后发表回答