Maison > Questions et réponses > le corps du texte
能否帮忙分析下抛出这个的原因,代码如下:
09-22 17:35:59.644 20596-20596/com.android W/System.err: java.net.SocketTimeoutException: timeout
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okio.Okio$3.newTimeoutException(Okio.java:212)
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okio.AsyncTimeout.exit(AsyncTimeout.java:277)
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okio.AsyncTimeout$2.read(AsyncTimeout.java:244)
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:45)
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okhttp3.internal.http.Http1xStream$FixedLengthSource.read(Http1xStream.java:381)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:45)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at okio.ForwardingSource.read(ForwardingSource.java:35)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at retrofit2.OkHttpCall$ExceptionCatchingRequestBody$1.read(OkHttpCall.java:279)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at okio.RealBufferedSource.request(RealBufferedSource.java:66)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at com.squareup.moshi.BufferedSourceJsonReader.nextNonWhitespace
(BufferedSourceJsonReader.java:933)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at com.squareup.moshi.BufferedSourceJsonReader.doPeek
(BufferedSourceJsonReader.java:327)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at com.squareup.moshi.BufferedSourceJsonReader.peek
(BufferedSourceJsonReader.java:202)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at com.squareup.moshi.JsonAdapter$1.fromJson(JsonAdapter.java:65)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:33)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:33)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:23)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:117)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:211)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:106)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:133)
09-22 17:35:59.652 20596-20596/com.android W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
09-22 17:35:59.652 20596-20596/com.android W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
09-22 17:35:59.652 20596-20596/com.android W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
09-22 17:35:59.652 20596-20596/com.android W/System.err: at java.lang.Thread.run(Thread.java:818)
大家讲道理2017-04-18 10:19:37
Il se peut que la connexion ait vraiment expiré. Il existe deux façons de la tester
1 : Réglez le délai HttpConnectionTimeOut plus long, par exemple une minute
2 : Vous pouvez utiliser certains outils d'appel d'interface (Chrome plug-in Postman du navigateur) pour tester l'interface et consulter les résultats de l'appel. Si l'appel est normal, analysez-le pour voir s'il s'agit d'un problème avec votre propre code