0
を呼び出した後のInflaterを使用しようとする試みは私のスタックトレースです:アンドロイドはIllegalStateException:ここで終わり
<StackTrace>java.lang.IllegalStateException: attempt to use Inflater after calling end
at java.util.zip.Inflater.checkOpen(Inflater.java:332)
at java.util.zip.Inflater.setInput(Inflater.java:312)
at com.android.okhttp.okio.InflaterSource.refill(InflaterSource.java:106)
at com.android.okhttp.okio.InflaterSource.read(InflaterSource.java:62)
at com.android.okhttp.okio.GzipSource.read(GzipSource.java:80)
at com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:374)
at java.io.InputStream.read(InputStream.java:162)
at com.myProgram.services.DownloadService.onHandleIntent(DownloadService.java:58)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.os.HandlerThread.run(HandlerThread.java:61)
</StackTrace>
、ここではDownloadServiceのからのコードです:
InputStream input = connection.getInputStream();
byte data[] = new byte[1024];
long total = 0;
int count;
while ((count = input.read(data)) != -1) {
total += count;
Bundle resultData = new Bundle();
resultData.putInt("progress" ,(int) (total * 100/fileLength));
receiver.send(U_PROGRESS, resultData);
output.write(data, 0, count);
}
58行は次のようになります。
while ((count = input.read(data)) != -1) {
このエラーは、ランダムな場合に発生します。ダウンロードサービスは、新しいバージョンのアプリケーションをダウンロードするために使用されます。