Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/384.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:java.io.IOException:java.util.zip.DataFormatException:从服务器获取数据时距离太远无效_Java_Android_Android Asynctask - Fatal编程技术网

Android:java.io.IOException:java.util.zip.DataFormatException:从服务器获取数据时距离太远无效

Android:java.io.IOException:java.util.zip.DataFormatException:从服务器获取数据时距离太远无效,java,android,android-asynctask,Java,Android,Android Asynctask,我有一个代码,这是工作非常好的问题。 我正在运行一个异步任务以从android中的web服务器获取数据,问题是,当控件进入异步任务中的readLine时,我会收到一个异常,详细信息如下所示: BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuffer sb = new St

我有一个代码,这是工作非常好的问题。 我正在运行一个异步任务以从android中的web服务器获取数据,问题是,当控件进入异步任务中的readLine时,我会收到一个异常,详细信息如下所示:

BufferedReader reader = new BufferedReader(new
                        InputStreamReader(conn.getInputStream()));
                StringBuffer sb = new StringBuffer("");
                String line = "";

                while ((line = reader.readLine()) != null) {
                    sb.append(line);
                    break;
                }
堆栈跟踪:

05-24 21:10:41.261 11232-11476/com.fiesta W/System.err: java.io.IOException: java.util.zip.DataFormatException: invalid distance too far back
05-24 21:10:41.263 11232-11476/com.fiesta W/System.err:     at com.android.okhttp.okio.InflaterSource.read(InflaterSource.java:84)
05-24 21:10:41.263 11232-11476/com.fiesta W/System.err:     at com.android.okhttp.okio.GzipSource.read(GzipSource.java:80)
05-24 21:10:41.264 11232-11476/com.fiesta W/System.err:     at com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:349)
05-24 21:10:41.265 11232-11476/com.fiesta W/System.err:     at java.io.InputStreamReader.read(InputStreamReader.java:233)
05-24 21:10:41.266 11232-11476/com.fiesta W/System.err:     at java.io.BufferedReader.fillBuf(BufferedReader.java:145)
05-24 21:10:41.268 11232-11476/com.fiesta W/System.err:     at java.io.BufferedReader.readLine(BufferedReader.java:397)
05-24 21:10:41.270 11232-11476/com.fiesta W/System.err:     at com.fiesta.SearchPeople$1GetPeople.doInBackground(SearchPeople.java:131)
05-24 21:10:41.271 11232-11476/com.fiesta W/System.err:     at com.fiesta.SearchPeople$1GetPeople.doInBackground(SearchPeople.java:96)
05-24 21:10:41.272 11232-11476/com.fiesta W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:295)
05-24 21:10:41.273 11232-11476/com.fiesta W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-24 21:10:41.275 11232-11476/com.fiesta W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
05-24 21:10:41.276 11232-11476/com.fiesta W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
05-24 21:10:41.277 11232-11476/com.fiesta W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
05-24 21:10:41.279 11232-11476/com.fiesta W/System.err:     at java.lang.Thread.run(Thread.java:818)
05-24 21:10:41.280 11232-11476/com.fiesta W/System.err: Caused by: java.util.zip.DataFormatException: invalid distance too far back
05-24 21:10:41.282 11232-11476/com.fiesta W/System.err:     at java.util.zip.Inflater.inflateImpl(Native Method)
05-24 21:10:41.283 11232-11476/com.fiesta W/System.err:     at java.util.zip.Inflater.inflate(Inflater.java:237)
05-24 21:10:41.284 11232-11476/com.fiesta W/System.err:     at com.android.okhttp.okio.InflaterSource.read(InflaterSource.java:67)
05-24 21:10:41.285 11232-11476/com.fiesta W/System.err:     ... 13 more
我知道php中的数据没有损坏,我可以看到它正确地返回了对象

    <?php
include 'includes/conn.php';
ini_set('display_errors', 1);
$u_id = $_GET['uid'];
$s = $_GET['s'];
$result = array();
$res = mysqli_query($con,"select u_id, first_name, last_name, user_profile_image from main_user_login where concat(first_name, ' ', last_name) like '%$s%'");

while ($row = mysqli_fetch_array($res)) {
    array_push($result,
    array('u_id'=>$row['u_id'],
    'first_name'=>$row['first_name'],
    'last_name'=>$row['last_name'],
    'user_profile_image'=>$row['user_profile_image']
    ));
}
echo json_encode(array("result"=>$result));
mysqli_close($con);

数据分析不正确时抛出错误,可能是错误

当数据分析不正确时,可能会引发错误

更新,我试着在Nexus6上运行这个,它不起作用,但在Nexus4上运行得很好。你能找到解决这个问题的方法吗?我也在面对它@user3520457Update,我试着在Nexus 6上运行这个,它不起作用,但在Nexus 4上运行得很好。你能找到解决这个问题的方法吗?我也在面对它@用户3520457