Open sneharesapu opened 4 years ago
You have to add http://127.0.0.1 to your network security config for android version 9 and later .. like this
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
</domain-config>
and if you do not have an idea about what I am saying kindly check this link https://developer.android.com/training/articles/security-config
I added 127.0.0.1 because the library uses it as a default proxy. for me, it is working but still faces some issues and I do not know if it related to this or not
2019-12-17 15:44:39.301 28787-28819/com.example.videocachesample E/Pinger: Error reading ping response com.danikula.videocache.ProxyCacheException: Error opening connection for http://127.0.0.1:39266/ping with offset 0. Version: 2.7.1 at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:85) at com.danikula.videocache.Pinger.pingServer(Pinger.java:101) at com.danikula.videocache.Pinger.access$100(Pinger.java:33) at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:123) at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:119) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Caused by: java.io.IOException: Cleartext HTTP traffic to 127.0.0.1 not permitted at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:115) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:458) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:538) at com.danikula.videocache.HttpUrlSource.openConnection(HttpUrlSource.java:171) at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:78) at com.danikula.videocache.Pinger.pingServer(Pinger.java:101) at com.danikula.videocache.Pinger.access$100(Pinger.java:33) at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:123) at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:119) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) 2019-12-17 15:44:39.309 28787-28819/com.example.videocachesample I/chatty: uid=10200(com.example.videocachesample) pool-3-thread-1 identical 1 line 2019-12-17 15:44:39.317 28787-28819/com.example.videocachesample E/Pinger: Error reading ping response com.danikula.videocache.ProxyCacheException: Error opening connection for http://127.0.0.1:39266/ping with offset 0. Version: 2.7.1 at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:85) at com.danikula.videocache.Pinger.pingServer(Pinger.java:101) at com.danikula.videocache.Pinger.access$100(Pinger.java:33) at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:123) at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:119) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Caused by: java.io.IOException: Cleartext HTTP traffic to 127.0.0.1 not permitted at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:115) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:458) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:538) at com.danikula.videocache.HttpUrlSource.openConnection(HttpUrlSource.java:171) at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:78) at com.danikula.videocache.Pinger.pingServer(Pinger.java:101) at com.danikula.videocache.Pinger.access$100(Pinger.java:33) at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:123) at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:119) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) 2019-12-17 15:44:39.327 28787-28787/com.example.videocachesample E/Pinger: 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] 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.1 at com.danikula.videocache.Pinger.ping(Pinger.java:73) at com.danikula.videocache.HttpProxyCacheServer.isAlive(HttpProxyCacheServer.java:185) at com.danikula.videocache.HttpProxyCacheServer.(HttpProxyCacheServer.java:84)
at com.danikula.videocache.HttpProxyCacheServer.(HttpProxyCacheServer.java:69)
at com.example.videocachesample.App.newProxy(App.java:17)
at com.example.videocachesample.App.getProxy(App.java:13)
at com.example.videocachesample.MainActivity.onCreate(MainActivity.java:50)
at android.app.Activity.performCreate(Activity.java:7140)
at android.app.Activity.performCreate(Activity.java:7131)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2894)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3049)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-12-17 15:44:39.327 28787-28787/com.example.videocachesample I/HttpProxyCacheServer: Proxy cache server started. Is it alive? false