Skip to content

章节9.2.2 使用OkHttp 勘误 #43

@JasperZhan

Description

@JasperZhan

示例代码运行会有错误,无法获取数据

报错:CLEARTEXT communication to www.baidu.com not permitted by network security policy

因为Android 9.0 限制了明文流量的网络请求,非加密的流量请求会被系统禁止掉

需要在application节点添加android:usesCleartextTraffic="true"或者http换成https

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions