Enable HTTP Cleartext Traffic in .NET MAUI for Android

Learn how to enable HTTP cleartext traffic for .NET MAUI Android apps by setting `UsesCleartextTraffic=true` in your `MainApplication.cs` file.

In the Platforms/Android/MainApplication.cs file, add the cleartext attribute.

1
2
3
4
5
6
7
8
9
#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
{
    ...
}
Built with Hugo
Theme Stack designed by Jimmy