Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

App failing on some devices. API level?

RicardoSRicardoS ESMember ✭✭✭
edited May 28 in Xamarin.Forms

Hello to all.

Sooo, new problems, I guess. We have an app that, until now, worked perfectly on any device (except, maybe, really old smartphones). But suddenly, I think the last few weeks, it started to work well on some devices and not at all on others. We don't know exactly what is causing this.

Some data we have about this problem:

Xamarin forms App, but this is an issue with Android Devices.

The app requires a login which, sending the user and password thanks to an API, gives the user permission to enter the app and handle the data (not going to enter into details what this data is about). However, if the devices are equal or above Android 9 (I think that's API level 28), the login prompts an error as if the user and/or the password were incorrect. The funny thing is, if you try this on a device whose API level is bellow 28... it works!

Now, I hear you asking: "Maybe you should change the target Android version to 9 or above". And we did that! It is now at Android 10.0.99, or API level 30. And we had to update our SDK packages in order for the app to even compile (understandable). But nevertheless, the error persists.

And yes, the users' mobiles have connection (wifi, 4G, and whatnot), so is not their fault. We need a solution ASAP.

Many thanks to all of you and best regards.

Best Answer

  • RicardoSRicardoS ESMember ✭✭✭
    Accepted Answer

    Alright, we found it! We received one of the accursed devices and debugged on it, getting this exception:

    Java.IO.IOException: Cleartext HTTP traffic to not permitted

    And searching, we got to this post in StackOverflow:

    https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted

    On the first solution (and the one marked as correct), we had 4 options to try, but only the third option, adding "android:usesCleartextTraffic="true"" to the manifest in the application label, worked.

    So, that's the solution. Thank you to all and good luck with your projects.

    Regards

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    According to the information you provided, we couldn't find out the reason.
    If it is convenient for you, could you please add a diagnostic build output about this issue (As a file attachment or gist link), or a basic demo,which would be really appreciated?

  • RicardoSRicardoS ESMember ✭✭✭

    @jezh said:
    According to the information you provided, we couldn't find out the reason.
    If it is convenient for you, could you please add a diagnostic build output about this issue (As a file attachment or gist link), or a basic demo,which would be really appreciated?

    We are sorry, but a demo would be impossible.
    In order to provide a demo, we should create an app for the App Store, upload it and make our clients try it for us to see if it fails or not. And that would be incredibly time consuming. Given that we have way other projects, you can expect a demo by next year.

    Speaking about the files you mentioned, we are unsure about what do you mean. A diagnostic build? Can we generate that with Visual Studio for Mac?

    Regards

  • RicardoSRicardoS ESMember ✭✭✭
    Accepted Answer

    Alright, we found it! We received one of the accursed devices and debugged on it, getting this exception:

    Java.IO.IOException: Cleartext HTTP traffic to not permitted

    And searching, we got to this post in StackOverflow:

    https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted

    On the first solution (and the one marked as correct), we had 4 options to try, but only the third option, adding "android:usesCleartextTraffic="true"" to the manifest in the application label, worked.

    So, that's the solution. Thank you to all and good luck with your projects.

    Regards

Sign In or Register to comment.