This is my code to uspost an audio as a params to my server,but sometimes it would work fail ,i don't know where is wrong ,who can help me or give me some suggestion ,thank u~
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: expected 1875 bytes but received 2067 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.Http1xStream$FixedLengthSink.write(Http1xStream.java:279) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okio.RealBufferedSink.flush(RealBufferedSink.java:216) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okio.ForwardingSink.flush(ForwardingSink.java:39) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okio.RealBufferedSink.flush(RealBufferedSink.java:218) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at com.lzy.okhttputils.request.ProgressRequestBody.writeTo(ProgressRequestBody.java:61) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:47) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at com.lzy.okhttputils.interceptor.LoggerInterceptor.intercept(LoggerInterceptor.java:40) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.RealCall.access$100(RealCall.java:33) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at java.lang.Thread.run(Thread.java:841) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: java.net.ProtocolException: expected 1875 bytes but received 2067 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.Http1xStream$FixedLengthSink.write(Http1xStream.java:279) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okio.RealBufferedSink.flush(RealBufferedSink.java:216) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okio.ForwardingSink.flush(ForwardingSink.java:39) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okio.RealBufferedSink.flush(RealBufferedSink.java:218) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at com.lzy.okhttputils.request.ProgressRequestBody.writeTo(ProgressRequestBody.java:61) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:47) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 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: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at 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: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at 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.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at 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: at com.lzy.okhttputils.interceptor.LoggerInterceptor.intercept(LoggerInterceptor.java:40) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at 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: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.RealCall.access$100(RealCall.java:33) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: at java.lang.Thread.run(Thread.java:841) 11-04 15:14:11.930 21739-21739/com.smartstudy.smartmark D/dalvikvm: GC_FOR_ALLOC freed 4955K, 36% free 42107K/65148K, paused 56ms, total 56ms