Forum Xamarin.Android


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

When sending image to database, app crashes. Works fine for other data

I am developing a mobile app using Xamarin vs2017 C# which uploads some data to an online server with web request. The app works perfect on the VS Emulator and crushes in some cases when testing the apk on mobile phones.

To make things more clear, it will be better to list the similar problems I faced and are already solved. The app accesses pictures from gallery, uploads the chosen image [as byte array] and other text such as name to an online server using internet connection.

First, when it reached to the steps that it accesses the internet, it crashes. This was solved by giving the app permission to access INTERNET in Android Manifest.

Second, when it reached to the steps it accesses the gallery, it crashes. This was also solved by giving the READ_EXTERNAL_STORAGE permission in Android Manifest.

Now, after converting the image from gallery to a byte array, at the steps it uploads it to an online hosted database, it crashes. Other text data are submitted and stored successfully to the database. The problem is only when submitting the byte array image. In addition, it works fine with the emulator and stores images to the online database. I think this is also an Android Manifest permission issue and until now I couldn't find solution online.

Please point me out on what to do.

Thank you!


  • Lang_tu_bi_dienLang_tu_bi_dien VNMember ✭✭

    Please post your call upload image and your "Crash Log" here.

  • YosephMelkaYosephMelka USMember

    Hi Lang, Thanks for your concern. When I try it with smaller pictures, it worked. So now the problem is the size. I gotta make some scaling down!!!

Sign In or Register to comment.