AS-Devs / signalr_flutter

A flutter plugin for .net SignalR client.
https://pub.dev/packages/signalr_flutter
MIT License
19 stars 27 forks source link

Cleartext HTTP traffic to 10.0.2.2 not permitted #1

Closed misici234 closed 4 years ago

misici234 commented 4 years ago

Hi,

I created brand new Flutter project, copied and pasted your code there added my server URL and hub name and got the following error Cleartext HTTP traffic to 10.0.2.2 not permitted The Server URL points to SignalR server which works good with other packages (therefore, that one is not a problem). Please see the attached screenshot. I tried many thing to resolve this problem and I was just getting other errors. Please help. image

AyonAB commented 4 years ago

@misici234 you are trying to connect with an HTTP url instead of HTTPS. I will recommend you to move your url to HTTPS.

But if you absolutely need to connect with a HTTP url, then you need to add the following lines in the manifest of your android source.

<application android:usesCleartextTraffic="true">
    </application>

This is because of Network Security Config, which says,

Starting with Android 9 (API level 28), cleartext support is disabled by default.

If you need more helps on this, read this Stackoverflow Thread.