明明之前还是可以运行的练习,过段时间却运行不了,一直说访问后台超时,
对于这个问题我整整弄了两天加一个晚上,心酸。。。,上网找了很多但是都解决不了,我就差没有砸电脑了。
首先 :
第一步:Android Studio 的6.0的(api 23) SDK,不再提供(compile 'com.loopj.android:android-async-http:1.4.9')org.apache.http.*(只保留几个类).
所以使用 compile 'com.loopj.android:android-async-http:1.4.9' ,想它跑起来就不要使用6.0的apk啊
第二步:还有这个是最重要的 必须要 关闭电脑的防火墙 ,要不永远都访问不了后台,反正我就被这个防火墙整整弄了两天。。。
01-08 15:20:55.783 29271-29507/zhu.com.printing3 W/System.err: cz.msebera.android.httpclient.conn.ConnectTimeoutException: Connect to /192.168.23.1:8080 timed out
01-08 15:20:55.786 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
01-08 15:20:55.786 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:157)
01-08 15:20:55.787 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.conn.scheme.SchemeSocketFactoryAdaptor.connectSocket(SchemeSocketFactoryAdaptor.java:65)
01-08 15:20:55.787 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
01-08 15:20:55.787 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:145)
01-08 15:20:55.788 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
01-08 15:20:55.788 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
01-08 15:20:55.788 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
01-08 15:20:55.788 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:860)
01-08 15:20:55.789 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
01-08 15:20:55.789 29271-29507/zhu.com.printing3 W/System.err: at com.loopj.android.http.AsyncHttpRequest.makeRequest(AsyncHttpRequest.java:146)
01-08 15:20:55.789 29271-29507/zhu.com.printing3 W/System.err: at com.loopj.android.http.AsyncHttpRequest.makeRequestWithRetries(AsyncHttpRequest.java:177)
01-08 15:20:55.797 29271-29507/zhu.com.printing3 W/System.err: at com.loopj.android.http.AsyncHttpRequest.run(AsyncHttpRequest.java:106)
01-08 15:20:55.797 29271-29507/zhu.com.printing3 W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
01-08 15:20:55.797 29271-29507/zhu.com.printing3 W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-08 15:20:55.797 29271-29507/zhu.com.printing3 W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
01-08 15:20:55.797 29271-29507/zhu.com.printing3 W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
01-08 15:20:55.797 29271-29507/zhu.com.printing3 W/System.err: at java.lang.Thread.run(Thread.java:818)
01-08 15:20:55.800 29271-29507/zhu.com.printing3 W/System.err: cz.msebera.android.httpclient.conn.ConnectTimeoutException: Connect to /192.168.23.1:8080 timed out
01-08 15:20:55.800 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
01-08 15:20:55.800 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:157)
01-08 15:20:55.800 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.conn.scheme.SchemeSocketFactoryAdaptor.connectSocket(SchemeSocketFactoryAdaptor.java:65)
01-08 15:20:55.801 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
01-08 15:20:55.806 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:145)
01-08 15:20:55.806 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
01-08 15:20:55.806 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
01-08 15:20:55.807 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
01-08 15:20:55.807 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:860)
01-08 15:20:55.807 29271-29507/zhu.com.printing3 W/System.err: at cz.msebera.android.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
01-08 15:20:55.807 29271-29507/zhu.com.printing3 W/System.err: at com.loopj.android.http.AsyncHttpRequest.makeRequest(AsyncHttpRequest.java:146)
01-08 15:20:55.807 29271-29507/zhu.com.printing3 W/System.err: at com.loopj.android.http.AsyncHttpRequest.makeRequestWithRetries(AsyncHttpRequest.java:177)
01-08 15:20:55.808 29271-29507/zhu.com.printing3 W/System.err: at com.loopj.android.http.AsyncHttpRequest.run(AsyncHttpRequest.java:106)
01-08 15:20:55.808 29271-29507/zhu.com.printing3 W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
01-08 15:20:55.808 29271-29507/zhu.com.printing3 W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-08 15:20:55.808 29271-29507/zhu.com.printing3 W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
01-08 15:20:55.808 29271-29507/zhu.com.printing3 W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
01-08 15:20:55.808 29271-29507/zhu.com.printing3 W/System.err: at java.lang.Thread.run(Thread.java:818)
01-08 15:20:55.811 29271-29271/zhu.com.printing3 V/JsonHttpRH: response body is null, calling onFailure(Throwable, JSONObject)
01-08 15:20:55.814 29271-29271/zhu.com.printing3 W/JsonHttpRH: onFailure(int, Header[], Throwable, JSONObject) was not overriden, but callback was received