ZZR老师写的http请求、插件无法铭文传输即http协议无法使用 原创
BLUESKYHOST
发布于 2021-3-8 16:21
浏览
1收藏
按照ZZR老师的文档配置会走 onFailure 回调 提示无法明文传输
然后我翻阅配置文档的配置开启明文传输有提示
errorMessage:Failed to parse XML configuration from network_security_config
{
"app": {
"bundleName": "com.example.shangjinlieren",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 4,
"releaseType": "Beta2"
}
},
"deviceConfig": {
"default": {
"network": {
"usesCleartext": true,
"securityConfig": {
"domainSettings": {
"cleartextPermitted": true
}
}
}
}
},
"module": {
"reqPermissions": [{"name":"ohos.permission.INTERNET"}],
"package": "com.example.shangjinlieren",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home",
"action.list.detail"
]
}
],
"orientation": "unspecified",
"name": "com.example.shangjinlieren.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "shangjinlieren",
"type": "page",
"launchType": "standard",
"metaData": {
"customizeData": [
{
"name": "hwc-theme",
"value": "androidhwext:style/Theme.Emui.Light.NoTitleBar",
"extra": ""
}
]
}
}
]
}
}
©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
标签
赞
收藏 1
回复
相关推荐
确切点说,是安卓高版本和鸿蒙都不支持http这种简单粗暴的传输,要做下其他调整,明天按安卓的方式试试先,不行再来请教大神们
我对安卓一无所知
"deviceConfig": {
"default": {
"network": {
"usesCleartext":true
}
}
},
把里面的 "cleartextPermitted": true换成 "usesCleartext":true就可以了,sdk和文档不统一,别人不看文档只看sdk,就会犯错,sdk的enum文档是这个字符cleartextPermitted,文档里是 "usesCleartext":true。加油吧
我已经解决了
问题是鸿蒙不支持访问本地域名,只支持公网