[android studio在api 17上使用cleartext http

问题描述 投票:0回答:1

[我正在xammp上将php服务器用于localhost,我在更新之前就在工作(我认为),但是现在http连接给我一个例外:

W / System.err:java.io.IOException:的明文HTTP流量 不允许192.168.0.105

我曾尝试在android:usesCleartextTraffic="true"Application上添加AndroidManifrst,但还会出现下一个错误:

属性usesCleartextTraffic仅在API级别23和更高版本中使用(当前最小值为17)

我想保持对API 17的支持,发布我的应用程序时,我将在公共服务器上使用https,现在该怎么办?

android androidhttpclient
1个回答
0
投票

您不必将应用程序的minSdkVersion或targetSdkVersion设置为23(Android棉花糖)即可使用android:usesCleartextTraffic。在较旧的平台上,此属性被简单地忽略,因此无效。

参考-https://android-developers.googleblog.com/2016/04/protecting-against-unintentional.html?m=1

© www.soinside.com 2019 - 2024. All rights reserved.