当前位置: 首页 > 工具软件 > VideoCache > 使用案例 >

使用开源视频缓存库AndroidVideoCache com.danikula.videocache.ProxyCacheException

东郭骁
2023-12-01
                                                          com.danikula.videocache.ProxyCacheException: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT]. Version: 2.7.0
                                                              at com.danikula.videocache.Pinger.ping(Pinger.java:73)
                                                              at com.danikula.videocache.HttpProxyCacheServer.isAlive(HttpProxyCacheServer.java:183)
                                                              at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:120)
                                                              at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:101)
                                                              

 Android 9.0及以上的机器,报如上错误。

解决:res的xml文件夹下定义一个network_security_config.xml文件,内容如下

<network-security-config>

     <domain-config cleartextTrafficPermitted="true">

          <domain includeSubdomains="true">127.0.0.1</domain>

     </domain-config>

     <base-config cleartextTrafficPermitted="true">

          <trust-anchors>

              <certificates src="system" /> </trust-anchors>

      </base-config>

</network-security-config >

在AndroidManifest.xml的<application>中加入该配置

<application android:networkSecurityConfig="@xml/network_security_config"  ......></application>

 

亲测可行。

 类似资料: