1

My project gets Java.IO.IOException on

await client.GetAsync(apiUrl)

If I don't use async method, its returns System.AggregateException.

client.GetAsync(apiUrl).Result

exception

5
  • That means that device can not reach your server, or device has no internet (make sure that test device has internet access and also try to ping your server ip ) Commented Sep 30, 2018 at 10:06
  • Its reaches to api website on chrome. Also my application has this code on AssemblyInfo.cs file: [assembly: UsesPermission(Android.Manifest.Permission.Internet)] Also in manifest file: <uses-permission android:name="android.permission.INTERNET" /> Commented Sep 30, 2018 at 10:16
  • could try to open api url from chrome on your test device ? Commented Sep 30, 2018 at 10:23
  • Its reaches but there is a problem with application permissions I guess. I'm trying to test internet connection on application. Commented Sep 30, 2018 at 10:25
  • I'm not sure but I guess this is Cleartext error. Becouse when I try to post something on another page, It returned as Cleartext HTTP traffic to 192.168.1.7 not permitted. On GetAsync, Its not giving this error explanation. I will configure the permission and post the answer. Thank you. Commented Sep 30, 2018 at 10:55

2 Answers 2

2

This error is apparently becouse of Cleartext Traffic Permission. I added android:usesCleartextTraffic="true" attribute to application tag on AndroidManifest file and it fixed.

Sign up to request clarification or add additional context in comments.

Comments

0

In my case this error was caused by updating the Xamarin.Essentials NuGet to a version later than 1.7.5.

I solved the problem by adding:

<intent>
   <action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>

to my AndroidManifest.xml-file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.