1

这是我将音频作为参数发布到我的服务器的代码,但有时它会失败,我不知道哪里错了,谁可以帮助我或给我一些建议,谢谢你~

     OkHttpUtils.post(postUrl)
                .params("Filedata",new File(GlobalUtils.getRecordDirPath()
                        ,RECORD_TEMP_MP3))
                .execute(new JsonCallback<GradeSpeakingReportModel>(GradeSpeakingReportModel.class) {
                    @Override
                    public void onSuccess(GradeSpeakingReportModel gradeSpeakingReportModel, Call call, Response response) {

                    ....
                    }

                    @Override
                    public void onError(Call call, Response response, Exception e) {
                        super.onError(call, response, e);
                        ....

                    }
                });
    }

11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: java.net.ProtocolException: 预期 1875 字节但收到 2067 11-04 15:14:03.250 21739-21739/com.smartstudy .smartmark W/System.err: 在 okhttp3.internal.http.Http1xStream$FixedLengthSink.write(Http1xStream.java:279) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err:在 okio.RealBufferedSink.flush(RealBufferedSink.java:216) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okio.ForwardingSink.flush(ForwardingSink.java:39) 11 -04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okio.RealBufferedSink.flush(RealBufferedSink.java:218) 11-04 15:14:03.250 21739-21739/com.smartstudy .smartmark W/System.err:在 com.lzy.okhttputils.request.ProgressRequestBody.writeTo(ProgressRequestBody.java:61) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:47) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal .connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java :92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14: 03.250 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 11-04 15:14:03.250 21739-21739/com .smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RetryAndFollowUpInterceptor。拦截(RetryAndFollowUpInterceptor.java:124)11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)11- 04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.255 21739-21739/ com.smartstudy.smartmark W/System.err:在 com.lzy.okhttputils.interceptor.LoggerInterceptor.intercept(LoggerInterceptor.java:40) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System .err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http。 RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03。255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System。错误:在 okhttp3.RealCall.access$100(RealCall.java:33) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.RealCall$AsyncCall.execute(RealCall. java:120) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W /System.err:在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-04 15:14:03。255 21739-21739/com.smartstudy.smartmark W/System.err:在 java.lang.Thread.run(Thread.java:841) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/ System.err:java.net.ProtocolException:预期 1875 字节,但收到 2067 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.Http1xStream$FixedLengthSink。写(Http1xStream.java:279)11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okio.RealBufferedSink.flush(RealBufferedSink.java:216)11-04 15:14 :03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okio.ForwardingSink.flush(ForwardingSink.java:39) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System .err: 在 okio.RealBufferedSink.flush(RealBufferedSink.java:218) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 com.lzy.okhttputils.request.ProgressRequestBody.writeTo(ProgressRequestBody.java:61) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.CallServerInterceptor .intercept(CallServerInterceptor.java:47) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11 -04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 11-04 15:14:03.255 21739-21739 /com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System。错误:在 okhttp3.internal.http.RealInterceptorChain。继续(RealInterceptorChain.java:67)11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)11- 04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.260 21739-21739/ com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err :在 okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain。继续(RealInterceptorChain.java:92)11-04 15:14:03.260 21739-21739/com。smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed( RealInterceptorChain.java:67) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 com.lzy.okhttputils.interceptor.LoggerInterceptor.intercept(LoggerInterceptor.java:40) 11- 04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.260 21739-21739/ com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java :170) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.RealCall.access$100(RealCall.java:33) 11-04 15:14:03.260 21739- 21739/com.smartstudy.smartmark W/System.err:在 okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err : 在 okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1112) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err:在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 java.lang.Thread.run (Thread.java:841) 11-04 15:14:11.930 21739-21739/com.smartstudy.smartmark D/dalvikvm: GC_FOR_ALLOC 释放 4955K,36% 释放 42107K/65148K,暂停 56ms,总共 56ms

4

0 回答 0