gpt4 book ai didi

未找到证书路径的 Android DownloadManager 信任 anchor

转载 作者:行者123 更新时间:2023-11-29 23:44:47 29 4
gpt4 key购买 nike

我搜索了很多帖子,但找不到任何解决方案或问题的答案。如何从安装了中间证书的站点下载文件?使用 DownloadManager 时,出现错误“java.security.cert.CertPathValidatorException:未找到证书路径的信任 anchor ”。尝试下载文件时。我看到过一些帖子,我应该在这篇文章中使用类似的东西 https://developer.android.com/training/articles/security-ssl#java但是我真的不知道应该如何为 downloadmanager 设置 SslSocketFactory 以便他可以使用它来下载文件。

最佳答案

好的,我已经找到解决方案了。只需添加到您的 list 中

然后到 res -> xml -> 带有以下代码行的新文件 network_security_config

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config>
<domain includeSubdomains="true">example.pl</domain>
<trust-anchors>
<certificates src="@raw/path_to_cert"/>
</trust-anchors>
</domain-config>
</network-security-config>

关于未找到证书路径的 Android DownloadManager 信任 anchor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51525328/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com