如何在 xamarin android 中修复“不允许明文 HTTP 流量到 x" [英] How to fix 'Cleartext HTTP traffic to x not permitted' in xamarin android

查看:28
本文介绍了如何在 xamarin android 中修复“不允许明文 HTTP 流量到 x"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序明文 HTTP 流量出现问题,x 不允许.

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

我已经试过把 android:usesCleartextTraffic="true";在我的清单中.但我想改变android:usesCleartextTraffic"标记为假"以防止发送未加密的流量.

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.

如何解决这个问题?

推荐答案

你可以用一行代码解决这个问题.在 android 项目中的属性下打开 AssemblyInfo.cs 并添加以下代码:

You can fix this with one line of code. Open AssemblyInfo.cs in your android project under properties and add the code below:

[assembly: Application(UsesCleartextTraffic = true)]

这篇关于如何在 xamarin android 中修复“不允许明文 HTTP 流量到 x"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆