UpdateAppUtils
UpdateAppUtils copied to clipboard
HTTPS方式无法下载
使用App内下载,设置manifest如下,调用HTTPS下载路径时出错。
android:networkSecurityConfig="@xml/network_security_config"
android:usesCleartextTraffic="true"
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
日志错误如下:
E/[UpdateAppUtils]: ----使用FileDownloader下载-------
pending:soFarBytes(0),totalBytes(0)
E/[UpdateAppUtils]: 下载出错,尝试HTTPURLConnection下载
E/[UpdateAppUtils]: ----使用HttpURLConnection下载----
D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true
E/[UpdateAppUtils]: HttpURLConnection下载失败:java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
E/[UpdateAppUtils]: error:java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
E/[UpdateAppUtils]: 删除成功
使用浏览器方式下载没问题。