How do I debug image problems on test devices? (URI correct, binding correct, image doesnt show)

Hello community,

I've a page with a ListView.. The list contains some Images, lets say 50. As soon as the user scrolls to the bottom and last item is shown, I load further json-documents from a webservice and add them to the list. The json-documents contain the image url. The following snippet shows how I bind the URI.

Image Picture = new Image()
{
    Aspect = Aspect.AspectFit,
    HorizontalOptions = LayoutOptions.StartAndExpand
}; // ImageSource.FromUri(new Uri("sImageUrl"))
Picture.SetBinding(Image.SourceProperty, "sImageUrl");
Picture.Margin = 5;

The problem: some images dont show on my Android / iOS test devices. The URIs are correct and some images show on the Android device BUT NOT on the iOS device. And some images show on the iOS device BUT NOT on the Android device. All images show in the iOS simulator.. That stuff drives me mad ;)

What I tried so far:
-> Checked the URIs to the images. The URIs are correct e.g. http://imgsrv.toppreise.ch/logo/[email protected]
-> Binding the URIs to source property (as shown above - works mostly but but not for all images)
-> Compared image size of images which show and which dont show (the images which dont have approx. the same size as the images which show - some are even smaller)
-> Implemented custom renderer with own property which sets source as soon as element changes (works mostly but but not for all images)

Has someone of you another idea how to get to the failure / bug which I've got in the software?

The custom renderer for Android looks e.g.:

using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;
using System;

[assembly: ExportRenderer(typeof(TPApp.AsyncSrcImage), typeof(TPApp.AsyncSrcImageRenderer))]
namespace TPApp
{
    public class AsyncSrcImageRenderer : ImageRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
        {

            base.OnElementChanged(e);

            TPApp.AsyncSrcImage oImage = (TPApp.AsyncSrcImage)Element;

            if (oImage != null && oImage.AsyncImgUrl != "")
            {

                oImage.Source = ImageSource.FromUri(new Uri(oImage.AsyncImgUrl));

            }

        }

    }
}

When running the App in debugging mode on Android, the following informations are shown in the application output:

[Mono] [0x9bf31000] hill climbing, change max number of threads 4
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_new_object_array'.
[Mono] Probing 'java_interop_jnienv_new_object_array'.
[Mono] Found as 'java_interop_jnienv_new_object_array'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_set_object_array_element'.
[Mono] Probing 'java_interop_jnienv_set_object_array_element'.
[Mono] Found as 'java_interop_jnienv_set_object_array_element'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_get_object_array_element'.
[Mono] Probing 'java_interop_jnienv_get_object_array_element'.
[Mono] Found as 'java_interop_jnienv_get_object_array_element'.
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md5b60ffeb829f638581ab2bb9b1a7f4f3f.ActivityIndicatorRenderer
[Choreographer] Skipped 31 frames!  The application may be doing too much work on its main thread.
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md52d2da11074036b7978d7ca80023c42c8.CustomMultiLineLabelRenderer
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md52d2da11074036b7978d7ca80023c42c8.ListPriceTypeRendererRenderer
[art] Explicit concurrent mark sweep GC freed 5649(306KB) AllocSpace objects, 9(144KB) LOS objects, 39% free, 24MB/40MB, paused 1.320ms total 17.940ms
[Mono] GC_TAR_BRIDGE bridges 143 objects 12742 colors 143 ignored 6298 sccs 143 xref 0 cache 0/0 setup 0.12ms tarjan 6.87ms scc-setup 0.17ms gather-xref 0.01ms xref-setup 0.00ms cleanup 1.73ms
[Mono] GC_BRIDGE: Complete, was running for 22.18ms
[Mono] GC_MINOR: (Nursery full) time 19.33ms, stw 19.50ms promoted 850K major size: 2912K in use: 2233K los size: 10240K in use: 7913K
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null
Offset: 10
[Mono] [0xb350d000] hill climbing, change max number of threads 5
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null

Of course I've seen, that the SkImageDecoder returned sometimes null.. But how is it possible, that the images show on iOS but (in this case) not on Andriod (pretending that the images for which the null value has been returned are the images which are not showing.. I've read in another thread, that the null value can be returned and the images are still shown)?

Is it possible, that Android / iOS have problems binding image urls without extensions for the images (e.g. .png)? If that would be the problem, I think no image would be displayed..

It'd be great if someone of you has a tipp where / how I can find the error/bug.

Thank you very much.

Alex

Best Answer

Answers

Sign In or Register to comment.