ArbiterUnknown
ArbiterUnknown

Reputation: 113

Why are my Xamarin UWP Images not showing up on device?

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}" />

Upvotes: 0

Views: 2551

Answers (4)

SendETHToThisAddress
SendETHToThisAddress

Reputation: 3704

I also had the issue with images not showing up on my UWP app. The images were showing up on my Android project but not UWP. For me the solution was to add the file extension. For some reason "myimage" works on Android but not on UWP, has to include the file extension like "myimage.png". Just wanna leave this here for anyone else potentially experiencing the same issue.

Upvotes: 0

Daniel Luberda
Daniel Luberda

Reputation: 7454

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);

Upvotes: 0

ArbiterUnknown
ArbiterUnknown

Reputation: 113

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

Upvotes: 2

Raxak
Raxak

Reputation: 399

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.

Upvotes: 0

Related Questions