Xamarin Forms - Images fetching from URL is not displaying in Android

Prasanth Kumar 21 Reputation points
2021-03-24T10:04:19.037+00:00

I'm trying to fetch an image from the URL for my Xamarin Forms project.

<ci:CircleImage Source="{Binding displayPicture}" WidthRequest="50" HeightRequest="50" VerticalOptions="CenterAndExpand"  Aspect="AspectFill" BorderColor="#5bb6e7" BorderThickness="2"/>

Previously i was working on Visual studio 2017 V15.9.30. It simply shows the image from URL. Even in iOS, it is working fine. enter image description here(Visual Studio 2017) enter image description here(iOS)

Currently, i have updated to visual studio 2019 v16.8.5. But here image is not getting displayed. Same code is running on both the versions but can't get the image in Visual Studio 2019. enter image description here(Visual studio 2019)

I've tried all possible solutions but it isn't working yet. Can someone help me out with this, please?

Points i have tried :

Image source URL is HTTPS.
HttpClient Implementation is Managed
SSL/TLS Implementation is Native TLS 1.2+
In Manifest file i have added android:usesCleartextTraffic="true"
Tried using ImageSourceConverter. But not able to include the library System.Net.WebCient

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,291 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,415 questions
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,936 Reputation points
    2021-03-24T11:31:57.423+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Hi, @Prasanth Kumar Did you update the nuget packages after updating the VS? Visual Studio may reference different apis by default with VS 2017. Try to update the nuget packages to the lastest stable version on both the shared project and each platform project. Then clean and rebuild. For Android, the lastest Xamarin.Forms 5.0 requires the TargetFramework to be Adnroid 10 or above and AndroidX is now the default on Android. If you defined some cusotm code in Android project, please change the related namespaces to AndroidX.*.

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful