本文共 359 字,大约阅读时间需要 1 分钟。
错误:
W/System.err: java.net.UnknownServiceException: CLEARTEXT communication to 10.114.35.103 not permitted by network security policy
原因:新的保护机制对于仅使用安全通信的应用,Android 6.0 Marshmallow(API 级别 23)引入了两种机制来解决回退到明文通信的问题:(1) 在生产/安装库中,禁止明文通信(2) 在开发/QA 期间,在遇到任何非 TLS/SSL 通信时,予以记录或者触发崩溃。
解决办法:AndroidManifest.xml 文件,在 application 元素中添加:
android:usesCleartextTraffic="true"
转载地址:http://nwdub.baihongyu.com/