Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'Cleartext HTTP traffic to x not permitted' in xamarin android

I have an issue in my application Cleartext HTTP traffic to x not permitted.

I've already tried putting android:usesCleartextTraffic="true" in my manifest. But i want to change "android:usesCleartextTraffic" flag to "false" to prevent unencrypted traffic from being sent.

How to solve this?

like image 208
SoftDev Avatar asked Dec 01 '25 03:12

SoftDev


1 Answers

If at some point you want to move to MAUI (which has no AssemblyInfo.cs), you might want to add UsesCleartextTraffic to your Application attribute in Platforms/Android/MainApplication.cs:

#if DEBUG                                   // connect to local service on the
[Application(UsesCleartextTraffic = true)]  // emulator's host for debugging,
#else                                       // access via http://10.0.2.2
[Application]                               
#endif
public class MainApplication : MauiApplication
{
    ...
}
like image 186
thomiel Avatar answered Dec 02 '25 19:12

thomiel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!