无法更新设备上的文件:HttpException:在收到完整的标头之前,连接已关闭

时间:2019-08-24 15:36:40

标签: android flutter

我已经构建了一个Flutter应用程序,当尝试在较旧版本的android API 16上运行时,不幸的是该应用程序已停止,并显示错误消息。在控制台中,它显示了无法更新设备上文件的错误消息:HttpException:连接已满之前关闭已收到标头,uri = http://127.0.0.1:64386/UnbKN1wrm_A=/

2 个答案:

答案 0 :(得分:1)

在GitHub中展开的讨论中,错误的罪魁祸首似乎是Android Q Emulator本身。

以下是与此相关的问题:

由于这是模拟器问题,所以我认为最好的选择是等待更新或尝试进行run your Flutter app in a physical device as suggested

如果物理设备不可用,一些临时解决方法是创建另一个emulated device like Pixel 2 Android 9.0 Target (28 API)

答案 1 :(得分:0)

我有同样的错误,我注意到如果我的代码在“文本类”中不带字母,则会运行该代码。 一个例子:

import 'package:flutter/material.dart';
void main(){
  runApp(MaterialApp(
      title: "Count People",
      home: Column(
        children: <Widget>[
          Text(".", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
          ),
          FlatButton(
              child: Text("ButtonTest", style: TextStyle(color: Colors.white),),
              onPressed: (){}
          ),
        ],
      )
  ));
}

”。 (点)在我的文本类中不会引起错误,但是如果您输入任何字母(a,b,c ...),则会出现与您相同的错误。

错误代码:

import 'package:flutter/material.dart';
void main(){
  runApp(MaterialApp(
      title: "Count People",
      home: Column(
        children: <Widget>[
          Text("a", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
          ),
          FlatButton(
              child: Text("ButtonTest", style: TextStyle(color: Colors.white),),
              onPressed: (){}
          ),
        ],
      )
  ));
}

控制台错误输出:

Performing hot restart...
Syncing files to device Flutter...
Restarted application in 2.687ms.
F/libc    ( 2131): Fatal signal 4 (SIGILL), code 2, fault addr 0xcee3f908 in tid 2148 (1.gpu)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Android/vbox86p/vbox86p:7.1.1/NMF26Q/392:userdebug/test-keys'
Revision: '0'
ABI: 'x86'
pid: 2131, tid: 2148, name: 1.gpu  >>> br.com.myname.count_people <<<
signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0xcee3f908
    eax cdb8e5a8  ebx cf6fdbbc  ecx cdb8d430  edx 00000000
    esi 0000001b  edi 00000002
    xcs 00000023  xds 0000002b  xes 0000002b  xfs 0000006b  xss 0000002b
    eip cee3f909  ebp cdb8d378  esp cdb8d330  flags 00010246
backtrace:
...
#61 pc 0111accf  /data/app/br.com.myname.count_people-1/lib/x86/libflutter.so (offset 0x10fb000)
    #62 pc 000752b2  /system/lib/libc.so (_ZL15__pthread_startPv+210)
    #63 pc 000202ae  /system/lib/libc.so (__start_thread+30)
Lost connection to device.

使用flutter run命令输出端子错误:

Launching lib/main.dart on Flutter in debug mode...
Initializing gradle...                                              1,2s
Resolving dependencies...                                           2,6s
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        18,0s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...                         6,6s
I/Choreographer( 2267): Skipped 89 frames!  The application may be doing too much work on its main thread.
Syncing files to device Flutter...                                 F/libc    ( 2267): Fatal signal 4 (SIGILL), code 2, fault addr 0xcef18908 in tid 2284 (1.gpu)                      
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***                                                    
Build fingerprint: 'Android/vbox86p/vbox86p:7.1.1/NMF26Q/392:userdebug/test-keys'                                  
Revision: '0'                                                                                                      
ABI: 'x86'                                                                                                         
pid: 2267, tid: 2284, name: 1.gpu  >>> br.com.myname.count_people <<<                                        
signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0xcef18908                                                      
    eax cdc5c5a8  ebx cf7d6bbc  ecx cdc5b430  edx 00000000                                                         
    esi 0000001b  edi 00000002                                                                                     
    xcs 00000023  xds 0000002b  xes 0000002b  xfs 0000006b  xss 0000002b                                           
    eip cef18909  ebp cdc5b378  esp cdc5b330  flags 00010246                                                       
backtrace:    
...
#61 pc 0111accf  /data/app/br.com.myname.count_people-2/lib/x86/libflutter.so (offset 0x10fb000)         
    #62 pc 000752b2  /system/lib/libc.so (_ZL15__pthread_startPv+210)                                              
    #63 pc 000202ae  /system/lib/libc.so (__start_thread+30)                                                       
Lost connection to device.                                                                                         
Could not update files on device: HttpException: Connection closed before full header was received, uri =          
http://127.0.0.1:44139/D4BNlRCD8IA=/
Syncing files to device Flutter...                                                                                                     

任何可以帮助弄清为什么文本类断开我的模拟器的人都会感激不尽。