locked
Images not showing RRS feed

  • Question

  • User338623 posted

    I know this has been asked before, and I've read all the previous threads I can find.

    I can get backgrounds and images to show on the emulator fine. I can't get any to show on an Android device connected using LivePlayer.

    Images are in Resources/Drawable (also copied in to the hpdi etc. folders) File properties are AndroidResource, Copy always File names are lower case and just letters Image formats are PNG, and all are less than 30K I've cleaned and rebuilt I've tried switching between release and debug builds I've tried with fake image names, and it doesn't throw any errors (e.g. using missing.png, which doesn't exist) Help!

    It used to work, but after lots of unrelated work on the code using the emulator, when I go back to the LivePlayer it doesn't work. I had loads of problems with System.Json working sporadically, and so had to drop that in favour of newtonsoft, but along the way I updated all Nuget packages etc.

    <?xml version="1.0" encoding="utf-8" ?>
    <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:local="clr-namespace:SparkEVX3"
                 x:Class="SparkEVX3.MainPage"  BarBackgroundColor="#0e3c63" BarTextColor="Red" >
    
        <ContentPage BackgroundImage="background.png" Title="Status" >
            <ContentPage.Content>
            <StackLayout  VerticalOptions="Fill" HorizontalOptions="Fill" >
        ... 
                    </StackLayout>
        </ContentPage.Content>
       </ContentPage>
    </TabbedPage>
    
    Tuesday, August 29, 2017 1:31 PM

Answers

  • User180523 posted

    I confirm the images do show when I deploy to the physical device and run the app outside of Xamarin live player.

    Ok. So its just LivePlayer that doesn't work. Nothing surprising there. None of the live previewers or live players or Gorilla Player or ... any of them... do much better than about 50% expectation.

    Do as much as you can with the LivePlayer/Live Preview/Emulator app of your choice... Then test on a physical device. Its the only way to get a real idea of what is happening.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, August 29, 2017 2:31 PM

All replies

  • User180523 posted

    Do they show on a physical device? From Visual Studio "deploy" the app. Run it on the physical device. Do they show?

    Tuesday, August 29, 2017 2:06 PM
  • User338623 posted

    Hi Clint, I hadn't thought to try that. I confirm the images do show when I deploy to the physical device and run the app outside of Xamarin live player.

    Tuesday, August 29, 2017 2:26 PM
  • User180523 posted

    I confirm the images do show when I deploy to the physical device and run the app outside of Xamarin live player.

    Ok. So its just LivePlayer that doesn't work. Nothing surprising there. None of the live previewers or live players or Gorilla Player or ... any of them... do much better than about 50% expectation.

    Do as much as you can with the LivePlayer/Live Preview/Emulator app of your choice... Then test on a physical device. Its the only way to get a real idea of what is happening.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, August 29, 2017 2:31 PM
  • User338623 posted

    I wish I'd spoken to you 4 days ago :-) everything that breaks on the Liveplayer sprang into life once deployed and debugged on target: missing images, 'visualisation error' on enabling an elapsed timer delegate, reading a file from Assets....

    Tuesday, August 29, 2017 2:40 PM
  • User284706 posted

    I have the same (or at least a similar) issue where local images are not showing when I use the Live View feature even though the same images appear just fine when I use old-fashioned debugging on an emulator. Oddly, images loaded from a web site appear just fine when using Live View.

    So, as a workaround, instead of using: <Image Source="myimage.png" />

    I use the following during the design process: <Image Source="http://my.computers.ip/x/myimage.png" />

    I setup Window's built-in web server, IIS, to point a virtual directory named "x" to my project's Resources/Drawable folder (you'll need to set Everyone to have read-only rights to that folder, assuming your project is under your user home directory).

    I am working with a support person from Microsoft on the actual issue, and if I find a solution, I'll post it here.

    Tuesday, January 16, 2018 4:50 PM