我正在尝试从Parse恢复我的记录。这个班叫做评级。当我试图找到少于5个记录时,没有问题。但是当我试图找到更多记录时,会显示下一个堆栈:
com.parse.ParseRequest$ParseRequestException: i/o failure
at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:289)
at com.parse.ParseRequest$2.then(ParseRequest.java:144)
at com.parse.ParseRequest$2.then(ParseRequest.java:138)
at bolts.Task$15.run(Task.java:839)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.io.IOException: unknown format (magic number 227b)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:101)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
at com.parse.ParseDecompressInterceptor.intercept(ParseDecompressInterceptor.java:40)
at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:147)
at com.parse.ParsePlugins$1.intercept(ParsePlugins.java:115)
at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:147)
at com.parse.ParseHttpClient.execute(ParseHttpClient.java:122)
at com.parse.ParseRequest$3.then(ParseRequest.java:135)
at com.parse.ParseRequest$3.then(ParseRequest.java:132)
at bolts.Task$15.run(Task.java:839)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:830)
at bolts.Task.continueWithTask(Task.java:642)
at bolts.Task.continueWithTask(Task.java:653)
at bolts.Task$13.then(Task.java:745)
at bolts.Task$13.then(Task.java:733)
... 4 more
任何人都知道为什么会发生这种情况?
答案 0 :(得分:7)
为了使它工作我使用的是1.11.0版本(编译'com.parse:parse-android:1.11.0')。到目前为止没有任何问题。
答案 1 :(得分:3)
我有同样的错误,但对我来说,Android Api +19的查询工作正常,旧版本会抛出此异常
答案 2 :(得分:2)
创建一个ParseLogInterceptor类
public class ParseLogInterceptor implements ParseNetworkInterceptor {
@Override
public ParseHttpResponse intercept(Chain chain) throws IOException {
ParseHttpRequest request = chain.getRequest();
ParseHttpResponse response = chain.proceed(request);
// Consume the response body
ByteArrayOutputStream responseBodyByteStream = new ByteArrayOutputStream();
int n;
byte[] buffer = new byte[1024];
while ((n = response.getContent().read(buffer, 0, buffer.length)) != -1) {
responseBodyByteStream.write(buffer, 0, n);
}
final byte[] responseBodyBytes = responseBodyByteStream.toByteArray();
Log.i("Response_Body", new String(responseBodyBytes));
// Make a new response before return the response
response = new ParseHttpResponse.Builder(response)
.setContent(new ByteArrayInputStream(responseBodyBytes))
.build();
return response;
}}
在Parse.initialize()之前添加:
Parse.addParseNetworkInterceptor(new ParseLogInterceptor());
它对我有用。
来源:https://github.com/ParsePlatform/Parse-SDK-Android/issues/325
答案 3 :(得分:1)
这是Parse 1.12.0
中的错误。我在https://github.com/ParsePlatform/Parse-SDK-Android/issues/355的存储库上打开了一个问题 - 开发人员已经复制了它并正在修复它。
正如其他人所提到的,当前的解决方法是简单地回退到1.11.0
,或者针对API19或更高版本进行编译。